Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Specification interpretation question

On Tue, Aug 18, 2009 at 3:38 PM, christopher delahunt <christopher.delahunt@xxxxxxxxxx> wrote:
Merge merges the state into the managed object - in this case a new object into a new object it has to create.  Nothing exists on the database, so there is no point in putting in indirection into the new managed object's relationship; the relationship is null as the foreign key value at this point is null.  Until the object gets inserted, the relationship mapping has no way of knowing that the e1ID value is going into the databasefield that it is going to use for the foreign key.  So, if indirection were put in instead of null, it would perform a query using null as the foreign key anyway.  
You can flush and then refresh the entity to have the relationship populated in the transaction is the only way to do it without explicitly performing a find for e1.

Thanks for the clear reply.  To clarify one other point, if I merge this item in, and flush() and refresh(), it should still be the case under three out of four transaction isolation levels that no other part of my application can read the new E2 until my transactional EJB method completes, right?

Probably more performant to just write the boilerplate find() code...rats.  I mean, now I understand, but still...rats.  :-)

Thanks,
Laird

Back to the top