khalilj / sarasvati

Automatically exported from code.google.com/p/sarasvati
0 stars 0 forks source link

HibernateException: cannot simultaneously fetch multiple bags #47

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Started MySQL version 5.1
2. Invoke HibTestSetup.main()

What is the expected output? What do you see instead?
Jun 2, 2009 11:04:58 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Exception in thread "main" org.hibernate.HibernateException: cannot
simultaneously fetch multiple bags
    at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:66)
    at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:75)
    at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:43)
    at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:33)
    at
org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(Batc
hingEntityLoader.java:103)
    at
org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(Abstra
ctEntityPersister.java:1752)
    at
org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(Abstra
ctEntityPersister.java:1756)
    at
org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEnt
ityPersister.java:2989)
    at
org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractE
ntityPersister.java:2982)
    at
org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(Single
TableEntityPersister.java:690)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:290)
    at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
    at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfigur
ation.java:859)
    at
com.googlecode.sarasvati.example.hib.HibTestSetup.init(HibTestSetup.java:86)
    at
com.googlecode.sarasvati.example.hib.HibTestSetup.main(HibTestSetup.java:95)

Original issue reported on code.google.com by chungonn@gmail.com on 2 Jun 2009 at 3:13

GoogleCodeExporter commented 8 years ago
Hi Paul,

I managed to zoom in to the problem. It is caused by the lines 67 and 70 in 
HibGraph

 @OneToMany (fetch=FetchType.EAGER, mappedBy="graph", cascade=CascadeType.REMOVE)
  protected List<HibNodeRef> nodes;

  @OneToMany (fetch=FetchType.EAGER, mappedBy="graph", cascade=CascadeType.REMOVE)
  protected List<HibArc>     arcs;

If I set either one of the fetch to FetchType.LAZY the problem would go away. I 
am
curious why this problem didn't occur in Postgres and Hsql?

What would you recommend the best way to solve this issue?

Original comment by chungonn@gmail.com on 2 Jun 2009 at 3:32

GoogleCodeExporter commented 8 years ago

Original comment by chungonn@gmail.com on 3 Jun 2009 at 2:31

GoogleCodeExporter commented 8 years ago

Original comment by plor...@gmail.com on 19 Jun 2009 at 12:51

GoogleCodeExporter commented 8 years ago

Original comment by plor...@gmail.com on 29 Apr 2010 at 3:40

GoogleCodeExporter commented 8 years ago
Released with version 1.0.0

Original comment by plor...@gmail.com on 29 Apr 2010 at 3:53