Hibernate version: 3.2.2
Name and version of the database you are using: Oracle 10g
I've an Oracle view with 6 columns: name, id, company, department, reference, creationdate. I used all the columns (some columns are nullable) as the composite-id.
Is it ok to have nullable fields in composite-id or all fields in composite-id must be not-null?
In the view, there's a row with name & id, and when I try to query by criteria using these 2 fields, a list of 1 null object was returned. My mapping is as below:
Code:
<composite-id>
<key-property name="name" column="NAME" />
<key-property name="id" column="ID_NO" />
<key-property name="company" column="COMPANY" />
<key-property name="department" column="DEPARTMENT" />
<key-property name="reference" column="REFERENCE" />
<key-property name="creationDate" column="CREATION_DATE" />
</composite-id>
It is right that 1 object should be found, but it was null, does it means that Hibernate is unable to instantiate the object? I've the default constructor, a private attribute for the composite-id object (with getters/setters) and getters/setters and private attributes for all fields in the class as well.
Or this there a better way to do this in Hibernate?