Hibernate version: 3.2
Mapping documents: Annotations
Name and version of the database you are using: PostgreSQL
The generated SQL (show_sql=true):
The actual query has 5392 fields in SELECT Statement and 227 LEFT OUTER JOIN
Hi there !! Hibernate has been working great, I have 72 EntityBeans running in several persistence contexts, and they all work fine, nice and smooth for months, however, I decided to perform some cleanup, and executed a small
Code:
persistence.remove( bean ) ;
... on a important bean that will remove other beans in cascade using
Code:
@<*>ToMany(mappedBy="<something>", cascade = CascadeType.REMOVE , fetch = FetchType.LAZY ) // I tought fetch was the problem
... however, when the remove line runs, it starts running queries against poor little postgreSQL, several queries run fine, small reasonable queries, until PostgreSQL cries this error:
Code:
2006-11-13 16:02:06,198 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 54000
2006-11-13 16:02:06,199 ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: target lists can have at most 1664 entries
2006-11-13 16:02:06,201 INFO [STDOUT] org.hibernate.exception.GenericJDBCException: could not initialize a collection: [some.bean.SomeBean#<key>]
PostgreSQL won't execute the query and I don't blame him, the query is so big I'm not even going to post it in here (The actual query has 5392 fields in SELECT Statement and 227 LEFT OUTER JOINs!!), I've been checking my beans over and over, everything seems to be fine, I've been using them for months, and I really have no clue what would be creating such a humongous query.
Any ideas where to look for would be apreciated.
The full stack trace:
Code:
2006-11-13 16:02:06,198 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 54000
2006-11-13 16:02:06,199 ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: target lists can have at most 1664 entries
2006-11-13 16:02:06,201 INFO [STDOUT] org.hibernate.exception.GenericJDBCException: could not initialize a collection: [ava.cursos.entities.Producto.evaluacionesDiscretas#39]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1926)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:71)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1695)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:246)
at org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:196)
at org.hibernate.type.CollectionType.getElementsIterator(CollectionType.java:188)
at org.hibernate.engine.CascadingAction.getAllElementsIterator(CascadingAction.java:266)
at org.hibernate.engine.CascadingAction.access$100(CascadingAction.java:21)
at org.hibernate.engine.CascadingAction$1.getCascadableChildrenIterator(CascadingAction.java:52)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:288)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:185)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:160)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
at org.hibernate.engine.Cascade.cascade(Cascade.java:223)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBeforeDelete(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:169)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:110)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:790)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:782)
at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:47)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
at org.hibernate.engine.Cascade.cascade(Cascade.java:223)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeAfterDelete(DefaultDeleteEventListener.java:239)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:189)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:110)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:790)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:782)
at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:47)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:290)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:185)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:160)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
at org.hibernate.engine.Cascade.cascade(Cascade.java:223)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBeforeDelete(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:169)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:110)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:790)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:782)
at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:47)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:290)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:185)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:160)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
at org.hibernate.engine.Cascade.cascade(Cascade.java:223)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBeforeDelete(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:169)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:110)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:790)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:782)
at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:47)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:290)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:185)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:160)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
at org.hibernate.engine.Cascade.cascade(Cascade.java:223)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBeforeDelete(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:169)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:110)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:790)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:768)
at org.hibernate.ejb.AbstractEntityManagerImpl.remove(AbstractEntityManagerImpl.java:155)
at portlets.performers.administrar.CursoEliminarPerformer.processAction(Unknown Source)
at portlets.AdministracionDeContenidoPortletImpl.processAction(Unknown Source)
at org.jboss.portal.portlet.PortletContainer.invokeAction(PortletContainer.java:483)
at org.jboss.portal.portlet.PortletContainer.dispatch(PortletContainer.java:424)
at org.jboss.portal.server.app.ComponentInvocation.dispatch(ComponentInvocation.java:79)
< LOTS OF jBoss.PORTAL STACK >
Caused by: org.postgresql.util.PSQLException: ERROR: target lists can have at most 1664 entries
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1499)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1284)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:250)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:211)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
... 228 more