Hello,
I'm trying to do simple Java EE application, just to get a hold of EJB3 and I'm stuck for quite a few days. I've posted my problem on stackoverflow:
http://stackoverflow.com/questions/1858153/ejb-and-jpa-and-onetomany-transaction-too-long
One behavior I haven't mentioned in that post is this: when I create and persist a Contact object and want to add a PhoneNumber object to it, it takes long time (which varies) to take effect. When I try to remove that Contact object before the PhoneNumber is returned (it is in DB, it just can't be returned via EntityManager's find method immediately), I get transaction.RollbackException (DELETE on table 'CONTACT' caused a violation of foreign key constraint 'PHNENUMBERCNTACTID' for key (2401). The statement has been rolled back) - even thought removing works well on the same object a little later, when PhoneNumber object is found.
I tried to set fetch method to eager, that didn't work. When I try to run em.refresh right after I added the phoneNumber with em.create, it's saying entity is not managed.
I'm using GlassFish 2.1.
If you need additional information or source code, please let me know.
Thank you
[Message sent by forum member 'mkcm' ]
http://forums.java.net/jive/thread.jspa?messageID=375866