Hibernate version:3.0
I've posted something similar to this elsewhere, but I want to repeat it to refine it. I've spent more than a week trying to model my domain but I can't seem to make it work with Hibernate.
Let me give you an overview of my schema. I have three tables of interest:
Documents
doc_id
fc_id
name
...
Filecabinets
fc_id
title
tbl_name
num_flds
...
FileCabinetFields
fc_id
fld_id
col_name
col_type
col_size
....
Then their is a 4th table that is not defined in my schema. It is created by the application and its field names and types are stored in the FileCabinets table. Basically it is a way to provide further properties for each row in the Documents table. The only thing that every one of these tables has is:
doc_id
These external tables act as extra columns for each Document, but they are different for each filecabinet because each filecabinet needs different properties.
As you can probably deduce they have the following relationships:
A FileCabinet has many documents
A FileCabinet has many fields
A Field is associated with a column in an external table
Now, I know that Hibernate 3 isn't released for production but I thought I would try and see if it's mapping capabilities would be able to model my domain. I envision the mapping for my domain to look something like this
Code:
<class name="document">
<id name="id" column="doc_id" type="int" >
<generator class="hilo"/>
</id>
<property name="title" />
....<!-- The other properties that are defined in the concrete document table -->
...
<Unmapped Properties />
...
</class>
<Unmapped Properties />
This is where I need some way to map to the 4th table. Basically it is a
dynamic join. I would would do a join to whatever table is specified
in the filecabinet that owns the document.
I realize this might not be built in to Hibernate, but if someone could PLEASE point me in the direction as far as where I want to extend a class
somewhere so I can try and get this functionality.