Hello. I have hibernate with spring up and running and now am trying to make my first relationship between tables.
I have a table frameworks and a table ammendments. Which is a one to many relationship. In table ammendments I have a column frameID which relates to the primary key in table frameworks.
In my framework.hbm.xml file I have this:
Code:
<class name="be.eurodyn.costDB.model.Framework"
table="cdb_framework">
<id name="frameworkID" column="frameworkID">
<generator class="identity" />
</id>
<property name="frameworkDESC" type="string" />
<property name="frameworkVisible" type="integer" />
<property name="frameworkActive" type="integer" />
<property name="frameworkACYN" type="string" />
<set name="frameID"
lazy="false"
table="cdb_ammendment"
fetch="join">
<key column="frameID"/>
<one-to-many class="be.eurodyn.costDB.model.Ammendment"/>
</set>
and in my framework class I have getters and setters for frameID (the reason for this is I was getting an error that there were no getters and setters in my Framework class, although surely they should not be needed as the frameID is defined in the Ammendment class not the Framework class and stored in the Ammendment table!!!! )
in my Ammendment.hbm.xml file I have frameID as a property
Code:
<property name="frameID" type="integer" />
When I deploy the application I get this error
Code:
org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of be.eurodyn.costDB.model.Framework.setFrameID
These are my setters and getters in the framework class
Code:
public int getFrameID() {
return frameID;
}
public void setFrameID(int frameID) {
this.frameID = frameID;
}
Does anyone have any idea what might be going on here. All I am trying to do is a simple one-to-many relationship, this has got to be easy surely. I have spent a day and a half trying to sort this out and it is not making any sense. It must be easier than this surely.
Thanks for taking the time to read. Any hints or tips are much appreciated.
cheers
Martin