Hi,
I have a problem, I don't know exactly if it's a hibernate or a spring problem:
I have 2 tables:
FirstTable
SecondTable
- FirstTablePK(FK)(PK)
- SecondTablePK(PK)
- Name
and 2 classes to map the tables:
Class1:
Code:
@Entity
@Table(name="FirstTable")
public class FirstClass implements Serializable{
@Id
@Column(name="FirstTablePK")
@Type(type="integer")
private Integer id;
@Column(name="Name")
@Type(type="string")
private String name;
}
Class2:
Code:
@Entity
@Table(name="SecondTable)
public class SecondClass implements Serializable{
@Id
private SecondTablePK id;
@Column(name="Name")
@Type(type="string")
private String name;
@Embeddable
public class SecondTablePK implements Serializable{
public SecondTablePK(){}
@Column(name="SecondTablePK")
private Integer id;
@ManyToOne
@JoinColumn(name="FirstTablePK")
private FirstClass firstClassImpl.
}
}
When I try to run this I get the following exception:
Quote:
org.springframework.orm.hibernate3.HibernateSystemException: SecondClass$SecondTablePK; nested exception is org.hibernate.InstantiationException: No default constructor for entity: SecondClass$SecondTablePK
although I have a default constructor....
Any ideas...?