-->
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: legacy DB mapping problem
PostPosted: Mon Jan 28, 2008 10:17 am 
Newbie

Joined: Fri Jan 27, 2006 8:04 am
Posts: 8
I have a legacy mapping problem. I have two tables:

Table A:
- a_id (PK)

Table B:
- a_id (composite PK part 1)
- index (composite PK part 2)
- type (composite PK part 3) (can be 'I' or 'O')

horrible, and I can't change it. Anyway, in java I want

EntityA
- List<EntityB> iList;
- List<EntityB> oList;

where the members of iList have type 'I' and the members of oList have type 'O', and that's the only difference between them. And the collections are ordered on the index column in table B

Is there some way of mapping this?

Thanks for any tips.[/img]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 29, 2008 8:00 am 
Beginner
Beginner

Joined: Tue Nov 27, 2007 9:44 am
Posts: 46
Hi,

you could create two subclasses of EntityB and use discriminators to distinguish the Entities.

see http://www.hibernate.org/hib_docs/refer ... tance.html

Good Luck,
Frank


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.