-->
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: @ManyToOne inside @Embeddable causes exception
PostPosted: Wed Sep 01, 2010 1:03 pm 
Newbie

Joined: Sun Feb 14, 2010 10:13 am
Posts: 17
hello

i have a question regarding a case where i need to associate an entity type (Bar) inside an embedded type (Foo).
is there any way to do that? it seems that i can't work it out as i constantly get a java.util.ConcurrentModificationException. i use Hibernate 3.5.3 configured with Spring 3 sessionFactory, and it's done quite simply:
Code:
@Entity
public class Bar {
   ...
}

@Embeddable
public class Foo {
   private Bar bar;

   @ManyToOne
   @JoinColumn("BAR_ID")
   public B getB() {
      return this.b;
   }
   public void setB(B b) {
      this.b = b;
   }
}

now, whenever i try to run this, while loading (before committing any other actions), i keep getting:
Quote:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [META-INF/spring/dao-config.xml]:
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
...
Caused by: java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.remove(AbstractList.java:357)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1222)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:383)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1206)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:717)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
... 50 more

if i omit the @ManyToOne annotation everything else is working and the application loads fine.
i don't understand what's wrong with having a @ManyToOne association inside an embedded type? after all, it will be a part of an entity at runtime..

thanks
Yuval


Top
 Profile  
 
 Post subject: Re: @ManyToOne inside @Embeddable causes exception
PostPosted: Wed Sep 01, 2010 1:06 pm 
Newbie

Joined: Sun Feb 14, 2010 10:13 am
Posts: 17
sorry B = Bar in the above code obviously :]


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.