I am getting the following error:
Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
Googling for it I found references to conflicting libraries, but this seem not
to be y case. I am using Hibernate 4.0.1 and building with its Maven dependency,
and everything works fine unless I introduce the recursive structure below
(I removed extraneous fields to focus the problem).
I am trying to define a recursive structure:
Code:
public abstract class BaseStoredEntity {
private String id;
private String key;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
public class Deployment extends BaseStoredEntity {
private Deployment parent;
private Set<Deployment> children = new HashSet<Deployment>();
public Deployment getParent() {
return parent;
}
public void setParent(Deployment parent) {
this.parent = parent;
}
public Set<Deployment> getChildren() {
return children;
}
public void setChilren(Set<Deployment> children) {
this.children = children;
}
}
And here is the .hbm file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="net.cbsolution.ps.billing.domain">
<class name="Deployment" table="DEPLOYMENT">
<id name="id" column="ID" length="32">
<generator class="uuid.hex" />
</id>
<set name="children">
<key column="parent"/>
<one-to-many class="Deployment"/>
</set>
<property name="key" column="UKEY" length="40" />
<many-to-one class="Deployment" column="PARENT" name="parent" index="DEPL_PARNT" />
</class>
</hibernate-mapping>
Note: the cause seems to be the collection mapping, in fact if I comment out the
<set name="children"> ... </set> everything works fine, including many other sets
exactly analogous that I have in the application and are perfectly mapped.
The only exception that raises the error is this entity that is recursive.