-->
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.  [ 1 post ] 
Author Message
 Post subject: Unable to persist data using@onetoOne mapping
PostPosted: Thu Aug 05, 2010 7:29 am 
Newbie

Joined: Thu Aug 05, 2010 7:20 am
Posts: 1
I have 2 tables table A
with ID and name table B with ID and name

i want to insert data in 3rd table which will contain ID from both the tables
i.e tableC will have 2 columns : IDtableA IDTableB


In The mapping class of table A i am doing something like this
@OneToOne
@JoinTable(name = "TableA_X_TableB",
joinColumns ={@JoinColumn(name = "TableBId")})
public B getB() {
return b;
}
public void setB(B b)
{
this.b= b;
}

when i call from the code

A a = new A();
B b = new B();
service.persist(b);
a.setB(b);
service.persist(a);

I can see data in TableA , TableB but its not there in TableA_X_TableB which joins these two tables.
Has anyone seen this before , i have no clue why its happening.

Any help in this will be appriciated.

Thanks,


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

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.