Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3
Mapping documents:xml
Code between sessionFactory.openSession() and session.close():yes
Full stack trace of any exception that occurs:N/A
Name and version of the database you are using:Oracle 9i
The generated SQL (show_sql=true):N/A
Debug level Hibernate log excerpt:N/A
I have a complex foreign key that does not map to the primary key of the foreign table. Additionally, it requires a condition on another column. I would like this to be an object mapping, but can't seem to get the mapping to work. I am at a loss as to how to map this ( if it is possible).
Tables
Code:
Lookup_Table
id - pk
type
code
description
My_Table
id - pk
lookup_table_code
where clause example:Code:
select * from my_table m, lookup_table l
where m.lookup_table_code = l.code and l.type = 'xxx'
Additionally, the pojo MyTable class looks as follows:Code:
public class MyTable {
private long id
private LookupItem lookupType;
mapping:Code:
<many-to-one name="type" class="com.wachovia.retail.valueobjects.LookupItem" foreign-key="char_mod">
</many-to-one>
I am uncertain as to how to get the parameter l.type = 'xxx' into the mapping... the <formula> tag doesn't seem to work.
Thanks,
Michael