users@glassfish.java.net

Re: JPA: how to alter relation without fetching entire entities?

From: <glassfish_at_javadesktop.org>
Date: Mon, 21 May 2007 16:44:56 PDT

Hi Witold,

I assume that your question is about a uni-directional relationship
mapped to a join table. There's currently no way in JPA to remove join
table entries by bulk operations, as join tables are not exposed in
JPA.

The performance of the steps mentioned in your post depends on the JPA
persistence provider. TopLink usually caches relationship fields, so
it might cache the address collection internally, and there should be
no performance penalty retrieving it. Persons and addresses are also
cached, and there should be no database access to get the object
references.

Please try removing the addresses in memory as you described, and
check what queries are generated. The removals from the join table
will be executed at transaction commit.

-- markus.
[Message sent by forum member 'mf125085' (mf125085)]

http://forums.java.net/jive/thread.jspa?messageID=218233