Hibernate version: 3
Hi,
I am new to hibernate and I used the search function and google before I post here. I have a simple java class and I need to map it with hibernate-mapping files.
This is my class:
Code:
public class Berichtbuffer {
private Long idBerichtbuffer;
private Stuurgegevens stuurgegevens;
private String bericht;
private BerichtStatus berichtStatus;
private String zendendCode;
private String ontvangendCode;
private Set<Foutbuffer> foutmeldingen = new HashSet<Foutbuffer>();
**
getters + setters
**
}
My problem is with the 'private Stuurgegevens stuurgegevens'.
My mapping file looks like this:
Code:
<hibernate-mapping>
<class name="nl.messagedesign.stufkletser.hibernate.Berichtbuffer" table="berichtbuffer">
<id name="idBerichtbuffer" type="long" column="idBerichtbuffer" >
<generator class="native"/>
</id>
<component name="Stuurgegevens">
<property name="zenderGebruiker" access="field"/>
<property name="ontvangerGebruiker" access="field"/>
<property name="referentienummer" access="field"/>
</component>
<property name="bericht"/>
<property name="berichtStatus"/>
<property name="zendendCode"/>
<property name="ontvangendCode"/>
</class>
</hibernate-mapping>
'Stuurgegevens' class doesnt have an empty constructor, thats the exception that I'm getting --> No default constructor for entity: nl.messagedesign.stufkletser.werkenMetStUF.Stuurgegevens
Stuurgegevens is a class that consists of several fields. I need those fields in my 'Berichtbuffer' table, but I don't know how to map this with hibernate.
Do I have to copy all my fields in 'Stuurgegevens' to my 'Berichtbuffer' class or can I make clear to hibernate to use the fields in that class?
Thanks in advance.