openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <>
Subject I just don't get OpenJPA joins
Date Mon, 19 Apr 2010 18:06:39 GMT
I think I must be stupid or something, but I just don't' get the logic
behind joins in OpenJPA. Here is an example:



Public class User {



                String somekey;



                UserProfile profile;



      private List<Alert> alerts           



      private List<Address> locations;           




When I query the User class OpenJPA will query every single joined entity
and any entity that is joined to that entity etc etc,  a horribly
inefficient query when all I want is to retrieve the user itself and not
everything joined and joined and joined to the locations list.


Similarly, when  merge a User entity, the resulting update query is updating
ever entry the locations collection, when the only purpose of the
CascadeType.Refresh, is to force OpenJPA to create a join between User and
it's associated address's.


I'm using  2.0 Beta 3 but been battling with 1.2.x for the last year or so.
I use table per class.


One of my updates is so inefficient, a query against the DB using straight
SQL will take milliseconds, but OpenJPA will take 1 minute per row.





  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message