开发者

concurrency problem when trying to delete in jpa

I have 2 EARs 1_EAR and 2_EAR (these has websearvices and other code).Now i have 1 project DB_prj that is used for interacting with database.Now all projects 1_EAR,2_EAR, DB_prj have a persistence.xml in their respective meta-inf folder.Now only 1_EAR and 2_EAR have web.xml in it. 2_EAR is a new project which is developed by our team. 1_EAr is working fine.Now when i try to delete any record by using class developed which i placed in 2_EAR my code hangs and times out.To delete a record i call API from DB_prj which works fine when called from 1_EAR.In web.xml of 1_EAR and 2_EAR i have following in common. web.xml of 1_EAR has many other things whic are not present in web.xml of 2_EAR.

<persistence-context-ref>
 <persistence-context-ref-name>persistence/XYZPersist</persistence-context-ref-name>
 <persistence-unit-name>XYZPersist</persistence-unit-name>
 </persistence-context-r开发者_如何转开发ef>

Can any one help me in solving this problem?The above code i had placed in web.xml of 2_EAR after somone answered my post @ problem with JNDI


My bet would be your EAR#2 resolves context via JNDI, but the context was bound by EAR#1, with EAR#1 classloader; therefore somewhere deep in the belly of persistence API you probably get a ClassCastException because the class, though has the same name and package, was loaded by a different class loader.

My point is that two EARs should have different JNDI names for their persistence units. From your post it looks they are the same.

(Actually, the mention that insert/update works fine contradicts my hypothesis, but who knows.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜