I have two tables, we can call them A and B. I am using Microsoft SQL Server 2000, compound keys that map to each other, and one of them is a uniqueidentifier. I am having problems with my hibernate mapping (I believe, since I am getting an error on generation.
(ill modify these tables to eliminate the extra rows that I know are working fine)
A is defined as:
Col1 varchar(5) *** Primary Key
Col2 uniqueidentifier *** Primary Key
uname varchar(50)
B is defined as:
Col1 varchar(5) *** Primary Key
Col2 uniqueidentifier *** Primary Key
qtrNum integer *** Primary Key
subject varchar(50)
The two tables are joined by a one-to-many relationship. Col1 and Col2 are the keys used in the relationship mapping.
In my Hibernate Mapping file, I have the following (again, going to cut out extra stuff):
For A:
<composite-id name="comp_id" class="com.hibernate.TableAPK">
<key-property name="Col1" column="Col1"/>
<key-property name="Col2" column="Col2"/>
</composite-id>
...
<set
name="TableBs"
lazy="true"
inverse="true"
>
<key>
<column name="Col1" />
<column name="Col2" />
</key>
<one-to-many
class="com.hibernate.TableB"
/>
</set>
For B:
<composite-id name="comp_id" class="com.hibernate.TableBPK">
<key-property name="Col1" column="Col1"/>
<key-property name="Col2" column="Col2"/>
<key-property name="qtrNum" column="qtrNum"/>
</composite-id>
...
<many-to-one
name="TableA"
class="com.hibernate.TableA"
not-null="true"
>
<column name="Col1"/>
<column name="Col2"/>
</many-to-one>
The files have a bunch of other <property> tags for the other columns, but this is the part I'm pretty sure I'm having problems with.
When I run the ant task, I get the following:
BUILD FAILED: file:E:/project/build.xml: Schema text failed: Problem trying to set property type by reflection: Could not find a getter for Col1 in the class com.hibernate.TableAPK.
So I'm not certain what I left out in order for the program to be able to create a getter. If I add type statements to the fields in the composite-id area, such as making them strings, then it will create the java no problem, but when I run the application, I get the same error. I am not certain if it is because I have a uniqueidentifier type or not. That really isn't a string, but I couldnt find in the documentation anything about uniqueidentifier types.
If anyone can help me out at all, I would really appreciate it. I have been trying to solve this problem for hours and just keep hitting a wall.
Thanks,
Jeff
|