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: ConcurrentModificationExcp creating EntityManagerFactory
PostPosted: Tue Sep 04, 2007 3:24 am 
Newbie

Joined: Tue Sep 04, 2007 2:53 am
Posts: 7
I am getting a ConcurrentModificationException when creating an EntityManagerFactory.

I have three objects Order, Event and Audits that should be persisted. I have created Order as an Entity. Events and Audits are Embeddedable/Components such that
1) An Order contains a list of events.
2) An Event contains a list of audits.

The application works when only events are embedded into order and audits are not mapped/used. When event class is modified to contain the list of audits the exception is thrown.

Is there a rule against having component class references from within another component?

Would really appreciate if someone can take a look and let me know what im missing.

I have removed the getters/setters from the code below for posting purposes. The class definitions for order, event and audits are

Code:
@Entity
@Table(name="MY_ORDER")
public class Order
{
   @Id
   @GeneratedValue(strategy = GenerationType.AUTO)
   @Column(name="order_id")
   private long id;
   
   @Column(name="qty", nullable=false)
   private String quantity;
   
   @Column(name="item_cd", nullable=false)
   private String item_code;   
   
   @org.hibernate.annotations.CollectionOfElements
   @JoinTable(
      name = "ORDER_EVENTS",
      joinColumns = @JoinColumn(name = "order_id")
   )
   @org.hibernate.annotations.IndexColumn(name="event_id", base = 1)
   private List<Event> events;
}


Code:
@Embeddable
@Table(name="ORDER_EVENTS")
public class Event
{   
   @Column(name="event_desc", nullable=false)
   private String description;
   
   @org.hibernate.annotations.Parent
   private Order order;

   
   @org.hibernate.annotations.CollectionOfElements
   @JoinTable(
      name = "ORDER_AUDITS",
      joinColumns = @JoinColumn(name = "event_id")
   )
   private List<Audit> audits;   
}


Code:
@Embeddable
@Table(name="ORDER_AUDITS")
public class Audit
{
   @org.hibernate.annotations.Parent
   private Event event = null;
   
   @Column(name="attrib", nullable=false)
   private String field;
   
   @Column(name="new_val", nullable=false)
   private String oldValue;
   
   @Column(name="new_val", nullable=false)
   private String newValue;   
}


Error thrown when executing
Code:
EntityManagerFactory factory = new HibernatePersistence().createEntityManagerFactory( getConfig() );


Stack Trace
Code:
Exception in thread "main" java.util.ConcurrentModificationException
   at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
   at java.util.AbstractList$Itr.remove(Unknown Source)
   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1128)
   at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:316)
   at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1112)
   at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269)
   at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150)
   at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888)
   at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:706)
   at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:137)
   at com.fmrco.test.dao.BaseDAO.getEntityManager(BaseDAO.java:27)
   at com.fmrco.test.dao.MyDAO.setEventsIntoOrder(MyDAO.java:33)
   at com.fmrco.test.dao.MyDAO.main(MyDAO.java:27)


Hibernate version: Core version - 3.2.1GA and Annotations version - 3.3.1GA



Code:
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 10:47 am 
Newbie

Joined: Wed Oct 03, 2007 12:28 pm
Posts: 15
According to this:

http://www.hibernate.org/329.html?cmd=c ... tnode=2718

---
I can't override the @JoinColumns of my @Embeddable object

Hibernate Annotations currently does not support associations inside embeddable objects.
---

I have a @CollectionOfElements inside one of my @Embeddable classes and I'm getting the same exact "ConcurrentModificationException" when I try to deploy my web service (which uses Hibernate persistence).

Does anyone know how to support a "Collection" inside an "@Embeddable" object?


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.