These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Recursive entity & SingleTableEntityPersister
PostPosted: Mon Mar 12, 2012 4:46 pm 
Newbie

Joined: Mon Mar 12, 2012 2:27 pm
Posts: 4
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.


Top
 Profile  
 
 Post subject: Re: Recursive entity & SingleTableEntityPersister
PostPosted: Tue Mar 13, 2012 4:35 am 
Newbie

Joined: Mon Mar 12, 2012 2:27 pm
Posts: 4
Let me respond to myself: the problem was a simple misspelling:
Quote:
public void setChilren(Set<Deployment> children) {
this.children = children;
}


instead of:

Quote:
public void setChildren(Set<Deployment> children) {
this.children = children;
}


What is really hard is to figure that org.hibernate.persister.entity.SingleTableEntityPersister exception
was caused by a misspelling error.

Anyway issue solved!


Top
 Profile  
 
 Post subject: Re: Recursive entity & SingleTableEntityPersister
PostPosted: Sun Sep 02, 2012 3:44 am 
Newbie

Joined: Thu Aug 30, 2012 8:33 pm
Posts: 4
why can't Hibernate be more specifc in the exception where the problem is rather than just saying HU-HAAA ?? the framework is not very good in problem description and coordinates


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.