Dear all,
I am new on hibernate and am currently running into trouble with the persistence of a list of blobs.
I have a class BlobData wich is used as a value type in another class Project. Projekt contains a java.util.List 'blobs'.
Code:
public class Project implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/** identifier field */
private long id;
/** nullable persistent field */
private String name;
private List blobs;
[...]
/**
*
* @return the List value of blobs.
*/
public List getBlobs(){
return blobs;
}
/**
*
* @param blobs - the new value for blobs
*/s
private void setBlobs(List blobs){
blobs = blobs;
}
public void addBlob(BlobData blob){
blobs.add(blob);
}
The mapping for this class looks like that:
<class name="Project" >
<id name="id" type="long" column="projektID" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" type="java.lang.String" >
<column name="name" not-null="false"/>
</property>
<list name="blobs">
<key column="projektID"/>
<list-index column="blobNr" />
<composite-element class="prozessdb.db.BlobData">
<property name="bez" type="java.lang.String">
<column name="bezeichnung" not-null="false"/>
</property>
<property name="inhalt">
<column name="inhalt" sql-type="LONGBLOB" />
</property>
</composite-element>
</list>
</class>
It is no problem to store BlobData objects in the Database. But whenever I retrieve a Project form the Database my blobs Object equals null.
Why is Hibernate not keeping a reference for the list?
Any hints would be very helpful.
Regards,
Udo