-->
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.  [ 6 posts ] 
Author Message
 Post subject: how mapping non POJO
PostPosted: Tue Oct 26, 2004 5:24 pm 
Beginner
Beginner

Joined: Tue Oct 07, 2003 4:32 pm
Posts: 36
Location: S
Hibernate version: 2.1

How I make the mapping (.hbm.xml) for ? :


public class AModel {
private String a_id;
private String field_b;
..

}
public class BModel {
private String AModel;
private String b_id;
...
}

Table A :
a_Id varchar2(10) PK
...

Table B :
a_Id varchar2(10) PK FK(table A, a_Id)
b_id varchar2(10) PK
...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 26, 2004 5:33 pm 
Regular
Regular

Joined: Tue Sep 28, 2004 6:34 pm
Posts: 50
The same way, hibernate can set private properties.

L.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 26, 2004 5:40 pm 
Beginner
Beginner

Joined: Tue Oct 07, 2003 4:32 pm
Posts: 36
Location: S
How I do that ? Its not working . because the pk from table B is compose fom two fields(mapped in a model(A) and a attribute in model B).

tks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 26, 2004 6:01 pm 
Regular
Regular

Joined: Tue Sep 28, 2004 6:34 pm
Posts: 50
check this:
http://www.hibernate.org/118.html#A10


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 26, 2004 6:12 pm 
Beginner
Beginner

Joined: Tue Oct 07, 2003 4:32 pm
Posts: 36
Location: S
I know that correct way is to use(I hope):
Code:
<composite-id>
<key-many-to-one name="a_id" class="AModel" column="a_id"/>
<key-property name="b_id" column="b_id" type="string"/>
</composite-id>


but when I load the object, it


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 26, 2004 6:44 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
use access=field if you don't have getters/setters


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.