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: Reg: Relations between tables using hbm files
PostPosted: Mon Nov 02, 2009 12:27 pm 
Newbie

Joined: Sat Oct 31, 2009 9:38 am
Posts: 5
Hi,

I have a requirement to get the data. but i am unable to set the relation in mapping files.
I am working on nhibernate2.2 with VS2008.My requirement is i have 2 entity classes "codes(primary table)" and "salesrep(child table)".
1.In "codes" table i have a column "primarycode" it is having 3 characters code.It is not a actual primary key column. Internally we consider as a logical primary key column.
2.In "salesrep" table i have "mapcode" it is having 2 character code (we removed the first char from "primarycode" and added remaining 2 characters as "mapcode" in child column).

(Our backend database is "FOX PRO" which was developed many years ago and tables are not in normalized way.)
ex : in "Codes--> primarycode =MAA then in "salesrep-->mapcode=AA.this is the saving process between 2 tables.

Now my requirement is in my "salesrep" entity class i have a property which returns the codes" entity.In My "codes" entity class i want to return the "salerep" list assigned to the "primarycode"( where codes.primarycode=MAA and salesrep.mapcode=AA)

I need help on this mapping.My questions are .....

1.Is it possible to get the result using hibernate mapping.?
2. If the above mapping is not possible can we get the same data structure using HQL queries?
3. Or any other way to get the data?

Any help can be appreciated.

Thanks & regards
Kiran


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.