Hi,
I am just a newbie in Hibernate but I have to face an old-ugly DB. Ugly because when we join tables, we always need to trim of fill in some spaces, even add some custom text to PK or FK.
Here is the problem: An ENTITY (have standard id = id) have corresponding EMPLOYEE (with composite key of Emp_code, Some_code) following the criteria below:
ENTITY.Some_code= trim (EMPLOYEE.Some_code) ENTITY.other_code = trim (EMPLOYEE.Emp_code)
What I have to achieve is: entity.getEmployee return an Employee (or even better employee.getEntity() return Entity) using the mapping file ENTITY.hbm.xml, without using additional DAO function . I have tried many ways but always failed: - one-2-one: From ENTITY - many-2-one: : From ENTITY - using formula: I picked up somes on the net but didn't find the proper one. - using loader and sql-query: but it is only available for set, not for one-2-one, property, many-2-one.....
Pls give me some hints or better with some samples.
Thank you
Last edited by phuyem on Tue Sep 14, 2010 10:48 am, edited 2 times in total.
|