Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Key already exists exception  RSS feed

 
Venkat Kommareddy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

this is method is in session maintain utility class and session builds when transaction starts.

1. public OpenJPAEntityManager getEntityManager() {
return this.getSession().getEntityManager();
}

below code is calling before merge

2. OpenJPAEntityManager pm = this.getEntityManager(); // will this line giving problem ?

if(this.isDetachable(pm, value.getClass())) {
value = pm.merge(value);
}

I am using 0.9 openjpa version. assigning entity manager from session to another object will create new entity manager object? version id not creating when we try to merge values in (oneToMany relation)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!