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
|
|