Hibernate #: 3 (any)
I have a rather unique situation where the database schema that I have to work with doesn't seem to be covered in any examples/doco. I hope I explain this well enough.
The sample schema that I have is as follows:
Code:
table code
(
code char 4
type char 4
data varchar 100
PRIMARY KEY(code,type)
)
table example
(
data1 ...
data2 ...
code char 4
...
)
As you can see from the 'example' table, to get the data from the 'code' table you need both keys. In the legacy application this is done programatically in the sql:
Code:
select example.data1, code.data
from example, data
where example.code = code.code
and code.type = 'TYPE'
Is there anyway to do this in the hibernate mapping file (which would be the preferred way) as opposed to programatically. If anyone could help me out on this, it would be much appreciated.