[jboss-user] [EJB 3.0] - Deployment error mapping a parent/child related entity

abl do-not-reply at jboss.com
Fri Jul 14 12:18:49 EDT 2006


I have a self-referencing entity hierarchy like that:

@Entity
  | @Inheritance(strategy=InheritanceType.JOINED)
  | public abstract class HrcEntity<T extends HrcEntity> extends ComplexEntity
  | {
  | 	private List<T> children;
  | 	private T parent;
  | 	
  | 	@OneToMany(mappedBy="parent", cascade=CascadeType.REMOVE)
  | 	public List<T> getChildren()
  | 	{
  | 		return children;
  | 	}
  | 	
  | 	@ManyToOne(fetch=FetchType.LAZY)
  | 	public T getParent()
  | 	{
  | 		return parent;
  | 	}
  |     
  | }
  | 
  | @Entity
  | @Inheritance(strategy=InheritanceType.JOINED)
  | public class Node extends HrcEntity<Node>
  | {
  | 	...
  | }

so I can do for example:

List<Node> children = node.getChildren();

but deploying these entities I get the error:
"java.lang.IllegalStateException: Property parent has an unbound type and no explicit target entity."

from my point of view this should work - there is is a table HrcEntity in db and hibernate simply has to map the column "parent" to the same table.

btw. - if I make HrcEntity non-generic it works, but I get very ugly code with lot of casts and "instanceof"

any comments? thanks!


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958144#3958144

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958144



More information about the jboss-user mailing list