openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <>
Subject RE: I just don't get OpenJPA joins
Date Tue, 20 Apr 2010 03:06:21 GMT
Yes these are enhanced at build time. I just loaded 34 lines of data and it
took nearly an hour to commit. By comparison If I export my database in
MySQL to an SQ script, blow the DB and then execute the script to recreate
the db and create all the data, it will take only about 30 seconds to
execute this script.

On point 2, if I have a User entity, with a join to a UserProfile entity as
per my example with CascadeType.Refresh on that join, merge causes the
UserProfile to be updated as well, but I only want the User entity itself to
be updated. There doesn't seem to b any way to join one entity to another so
OpenJPA will create the join table without some form of cascading. As a
result, a small change to an entity that is in a complex join hierarchy
causes cascading updated to the complete join hierarchy. This is horribly
inefficient and causes me stack overflows. In one example, I may just change
one letter in the Name field in my User entity and calling merge will
cascade like this:

User->UserProfile->Multiple Address entities each of which have joins to
Country entities, locale entities 

The generated SQL will try to update all of these entities all the way down
the hierarchy because all of those entities are joined to each other using

The only way I can see to prevent this behaviour is to remove an joins and
create manual joins on these fields, but this tends make me wonder why I
would use JPA in the first place when I am basically going back to EJB 2



-----Original Message-----
From: Pinaki Poddar [] 
Sent: Tuesday, 20 April 2010 7:52 AM
Subject: Re: I just don't get OpenJPA joins

1. Are the persistent entitiy classes enhanced at build-time? If not, try
build-time enhancement.
2. Post the query that joins unnecessarily.

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message