Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Key already exists exception

 
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