Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re[eclipselink-users] fresh entity throws java.lang.IllegalArgumentException

Hi everybody.
My program finds an entity called "module" made as follows : 

Module Entity : 

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idmodule")
    private Integer idmodule;
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Column(name = "side")
    private String side;
    @OneToMany(mappedBy = "moduleIdmodule", fetch=FetchType.EAGER,
cascade=CascadeType.ALL)
    private Collection<Cell> cellCollection;

Code : 

   module = em.find(Module.class, id);
   
   for(...)
     em.insert(new Cell(module,...));

   em.refresh(module);
   
I'm inserting a large amount of Cell entities related to my module istance
correctly (i see them in the database). After the insert transactions i want
to refresh my module entity : i need to see the new related collection of
cells. But when i call "entitymanager.refresh(module)" i always get this
exception : 
java.lang.IllegalArgumentException: Can not refresh not managed object
How is it possible? My module entity becomes unmanaged? why? i just found it
from the database before the inserts ...
-- 
View this message in context: http://www.nabble.com/Refresh-entity-throws-java.lang.IllegalArgumentException-tp25167220p25167220.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top