-->
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.  [ 2 posts ] 
Author Message
 Post subject: StackOverflowError with nested composite ids
PostPosted: Sun Sep 21, 2014 11:26 am 
Regular
Regular

Joined: Fri Dec 17, 2004 10:38 am
Posts: 54
Hi guys,

I came across a problem with a legacy schema mapping.

I have 3 tables, A, B, C, A has a reference to B, B has a reference to C. Both these references are a part of a primary key of a respective table.

So I mapped it like this:

Code:
@Entity
public class A {
   @EmbeddedId
   private AId id;
}
@Embeddable
public class AId {
   private int aId;
   @ManyToOne
   private B b;
}

@Entity
public class B {
   @EmbeddedId
   private B id;
}
@Embeddable
public class BId {
   private int bId;
   @ManyToOne
   private C c;
}

@Entity
public class C {
   @Id
   private int id;
}


The simple test code blows up with an exception:
Code:
Configuration cfg = new Configuration().addAnnotatedClass(A.class).addAnnotatedClass(B.class).addAnnotatedClass(C.class);
cfg.setProperty(AvailableSettings.DIALECT, H2Dialect.class.getName());
cfg.buildSessionFactory();


Quote:
java.lang.StackOverflowError
at org.hibernate.cfg.AbstractPropertyHolder.isInIdClass(AbstractPropertyHolder.java:150)
at org.hibernate.cfg.AbstractPropertyHolder.isInIdClass(AbstractPropertyHolder.java:150)
at org.hibernate.cfg.AbstractPropertyHolder.isInIdClass(AbstractPropertyHolder.java:150)
at org.hibernate.cfg.AbstractPropertyHolder.isInIdClass(AbstractPropertyHolder.java:150)
...
at org.hibernate.cfg.AbstractPropertyHolder.isInIdClass(AbstractPropertyHolder.java:150)
at org.hibernate.cfg.BinderHelper.getPropertyOverriddenByMapperOrMapsId(BinderHelper.java:819)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2169)
at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2629)
at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2524)
at org.hibernate.cfg.AnnotationBinder.bindComponent(AnnotationBinder.java:2473)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2198)
at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2629)
at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2524)
at org.hibernate.cfg.AnnotationBinder.bindComponent(AnnotationBinder.java:2473)
...
at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2524)
at org.hibernate.cfg.AnnotationBinder.bindComponent(AnnotationBinder.java:2473)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2198)
at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2629)


So the question is - is it a legitimate issue, or my mapping is wrong.

Hibernate: 4.3.6.Final


Top
 Profile  
 
 Post subject: Re: StackOverflowError with nested composite ids
PostPosted: Sun Sep 21, 2014 12:04 pm 
Regular
Regular

Joined: Fri Dec 17, 2004 10:38 am
Posts: 54
Sorry, my bad.
B.id is of a wrong type.
Problem solved.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.