[jboss-user] [EJB 3.0] - Re: EntityManager not auto-flushing at end of SLSB method
mazz@jboss.com
do-not-reply at jboss.com
Wed Jan 2 23:05:50 EST 2008
Oh, and one other thing. The entity manager will only flush changes that you made to attached POJO entities. You can't just do "new MyEntity()" and expect the entity manager to do anything with it. You must do either em.persist() to attach it as a new entity, an em.find() to load an existing entity into the entity manager session or something similar to load an existing entity into session (like execute a query).
em.merge() will, by definition, act as a em.persist() if the object you are merging isn't attached and is a new entity that does not yet exist in the DB.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116594#4116594
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116594
More information about the jboss-user
mailing list