I have an Account, which can contain a List of AccountAddresses ( which maps to ACCOUNT_ADDRESSES table). AccountAddresses contains an Address object (which maps to ADDRESS table) .
For one process (and the main one), I need to be able to persist an Account, which cascade persists the AccountAddresses, and Address objects.
For another, which uses AJAX to dynamically add a new address to an account... I simply need to be able to persist new AccountAddresses object, which may include an Address which already exists. In this case, I would only like the account_addresses table to have the record inserted.
Regardless of what I try to do, I always get the Address trying to be inserted. I need to use the em.persist so that I can get the ID of the object, which allows the user to remove it at that moment if necessary. I also set what JPA sees as the @Id and @version to the existing Address, but it doesn't seem to matter.
Can someone help me out?
Thanks,
Derrick
[Message sent by forum member 'a1programmer' (a1programmer)]
http://forums.java.net/jive/thread.jspa?messageID=230539