Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7728513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:44:12+00:00 2026-06-01T05:44:12+00:00

In my EJB project deployed on WAS 6.1, when I try to call EntityManamger.merge(obj),

  • 0

In my EJB project deployed on WAS 6.1, when I try to call EntityManamger.merge(obj), I get this exception:

Exception data: <openjpa-1.0.4-SNAPSHOT-r420667:955062 nonfatal store error> org.apache.openjpa.persistence.EntityExistsException: Attempt to persist detached object "com.data.entity.SomeEntity@23aa23aa".  If this is a new instance, make sure any versino and/or auto-generated primary key fields are null/default when persisting.
FailedObject: com.bmo.ctp.data.entity.attribute.RoleResServiceAttribute@23aa23aa
    at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2368)
    at org.apache.openjpa.kernel.AttachStrategy.persist(AttachStrategy.java:94)
    at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:95)
    at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
    at org.apache.openjpa.kernel.AttachStrategy.attachCollection(AttachStrategy.java:333)
    at org.apache.openjpa.kernel.AttachStrategy.replaceCollection(AttachStrategy.java:301)
    at org.apache.openjpa.kernel.AttachStrategy.attachField(AttachStrategy.java:220)
    at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:157)
    at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
    at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
    at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3161)
    at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
    at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
    at com.ibm.ws.jpa.management.JPAExEmInvocation.merge(JPAExEmInvocation.java:335)
    at com.ibm.ws.jpa.management.JPAEntityManager.merge(JPAEntityManager.java:123)

I do not have the source for JPAEntityManager.java; but I thought the EntityExistsException cannot be thrown by the merge() operation since merge will first do a check to see if entity exists. If not, insert it. If yes, update it.
What is going wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:44:14+00:00Added an answer on June 1, 2026 at 5:44 am

    Please check how your entitymanager checks the existence of an entity. Is it using Cache? or is it using a DB Query. This issue generally occurs, if the existence check is done through cache.

    if you are using eclipselink JPA, this configuration is maintained in orm.xml

    Thanks,
    Anand

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a Java EJB project being deployed to Weblogic 10.3.3.
I have a data access EJB project that has a number of EJB's I
I was trying to add the XML schema to an existing EJB project. JAXB
I have an old EJB (2.1) project that uses xdoclet (1.2.3) to generate the
Starting a new project using EJB 3 / JPA, mainly stateless session beans and
Now we have a project with java 1.4 and ejb 2.1 running on jboss
I work on an inherited project, old enough to use EJB 2.1 and JBoss
I would like to be able to package my jpa-ejb-web project as a standalone
I have an EJB 2.1 project, works on WebShere 7. I must migrate it
I would like to implement pagination in my Servlet/EJB/JPA-Hibernate project, but I can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.