-->
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: map a legacy system
PostPosted: Fri Aug 15, 2008 7:41 pm 
Newbie

Joined: Fri Aug 15, 2008 7:04 pm
Posts: 5
I need to map a legacy system:

public class A{
private AId id;
private Map<String B> m1;
private Map<String B> m2;
...
}
public class Aid{
private String id;
private String type;
...
}

database:

table AA{id, type, .....}
table BB{id, is_fine, ....}

(type is really of no use at all but I can not change the java code or the database)

both m1 and m2 should map to table BB. for elements in m1, the values of is_fine are true and for m2, the values are false

I have two questions:
(1) for id mapping, I can map id and type as compound primary key for table AA. But then I do not know in hibenate how I can make a foreign key in table BB to refer to part of the compound primary key in AA. If I can make the id in AId as the primary key in table AA, that is also fine. But I do not know how to map that.
(2)for the two maps, if I use <map> with <composite-element> when persist instance of A, there should be no problem but there is no way to separate the rows in BB and break into two maps based on value of is_fine

Can some Hibernate expert show me how they can be done? or not possible at all?

Thanks in advance


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.