-->
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: hibernate mapping
PostPosted: Wed May 19, 2010 5:35 am 
Newbie

Joined: Wed May 19, 2010 2:16 am
Posts: 1
There are two tables TableA and TableB.

TableA
id (pk), col_A1, col_A2
--------------------------------------------
1, 1000, col_a_val1
2, 1001, col_a_val2


TableB
id (pk), col_B (unique)
-----------------------
1000, col_b_val1
1001, col_b_val2

## TableA.col_A1 references TableB.id

public class TableAObj
{
private String id;
private String colA1;
private String colA2;

}

TableAObj is populated with the below values
- id = 1
- colA1 = col_b_val1;
- colA2 = col_a_val1

When TableAObj is persisted it should stamp the pk corresponding to “col_b_val1” (1000) in col_A1 of TableA. Also when TableAObj is loaded from database colA1 field should contain "col_b_val1" instead of 1000.

How to achieve this using hibernate mapping?


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.