-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Entity Manager persist Entity Twice.
PostPosted: Wed Nov 05, 2014 5:54 am 
Newbie

Joined: Wed Nov 05, 2014 5:47 am
Posts: 1
Hi,

I have a entity , which i persist to do DB. This entity is having two Many toMany Relation ship


@ManyToMany
@JoinTable(name = "TCOURSELL", joinColumns = { @JoinColumn(name = "ID_CO") }, inverseJoinColumns = { @JoinColumn(name = "ID_USR") })
private List<User> users = new ArrayList<User>();

@ManyToMany
@JoinTable(name = "TCOANODELL", joinColumns = { @JoinColumn(name = "ID_CO") }, inverseJoinColumns = { @JoinColumn(name = "ID_CON_NOD") })
private List<Node> nodes = new ArrayList<Node>();

Everything is works fine. new member is adding fine with his parents , but unfortunately Em added two same record to db but with the different PK, all other field are same?

Can somebody will sugget me the solution.


Top
 Profile  
 
 Post subject: Re: Entity Manager persist Entity Twice.
PostPosted: Wed Nov 05, 2014 9:14 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Hi,
at first glance I don't see anything wrong.

Could you provide more information, please? Maybe showing the mapping of the other entities and how you persist the object.

Best thing would be to provide a testcase, this would help us to help you a lot faster :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.