0 Replies Latest reply on Mar 23, 2010 2:32 PM by gregory v

    EntityManager refresh() issues individual SELECT statements

    gregory v Newbie

      Hi there,


      I have a simple entity that is managed using JPA. It is associated in OneToMany with another entity and the FetchMode is set to SUBSELECT for that particular association.


      I have found that a call to EntityManager.find() will issue 2 SELECT statements: one for the main entity and one with a subselect for its association, which is what I want.


      However, upon an update, I usually to the following:


      MyDTO test = myEntityManager.merge(aDTO);





      But in that case, the refresh will issue individual SELECT statements for each instance of my object's associated objects. Is there any way to make this work just like with a find()?