-->
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.  [ 1 post ] 
Author Message
 Post subject: Inheritance mapping problem with object PK
PostPosted: Thu Jun 07, 2012 5:26 am 
Newbie

Joined: Tue Mar 01, 2011 8:54 am
Posts: 5
I get an exception when trying to startup Hibernate 4.1.3

What can be the problem? I do not want map PK as Integer ids because i do not want to manually assign them after creating PK objects.


Code:
Code:
@Entity
@Data
public class Key1 {
   @Id
   private int id;
   private String dataKey1;
}

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Data
public class Base implements Serializable {
   private static final long serialVersionUID = -687728638968459923L;

   @Id
   @ManyToOne
   private Key1 key1;

   private String dataBase;
}
@Entity
public class Child extends Base {
   private static final long serialVersionUID = 1289037166773988611L;

}


Exception:
Code:
Caused by: java.util.NoSuchElementException
   at java.util.AbstractList$Itr.next(Unknown Source)
   at org.hibernate.internal.util.collections.JoinedIterator.next(JoinedIterator.java:76)
   at org.hibernate.cfg.Ejb3JoinColumn.buildJoinColumn(Ejb3JoinColumn.java:323)
   at org.hibernate.cfg.AnnotationBinder.makeInheritanceJoinColumns(AnnotationBinder.java:1126)
   at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:565)
   at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3435)
   at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3389)
   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1341)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1731)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1782)
   at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:189)
   at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:350)
   at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:335)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
   ... 38 more


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

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.