lazy evaluation - org.hibernate.exception.DataException: could not initialize a collection -
when try access collection (list) following way, following error, though within same usertransaction.
::: entityaccessorexception: org.hibernate.exception.dataexception: not initialize collection ::: caused by: org.hibernate.exception.dataexception: not initialize collection: ::: list<brand> brands = fulltextquery.getresultlist(); (brand b : brands) { iterator<brandpromodetails> i2 = b.getbrandpromodetails() .iterator(); while (i2.hasnext()) { brandpromodetails bpd = i2.next();
====================================================================================
whereas, when change follows, works. database derby , using hibernate jpa provider , using hibernate search. great if can provide explanation of behavior.
list<brand> brands = fulltextquery.getresultlist(); (brand b : brands) { @suppresswarnings("unchecked") list<brandpromodetails> i2 = em.createquery("select x brandpromodetails x bpdbrand_id = ?1") .setparameter(1, b.getid()) .getresultlist(); (brandpromodetails bpd : i2) {
complete stacktrace added:
here is..
[#|2011-02-23t22:34:04.711+0530|info|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_threadid=91;_threadname=thread-1;|hibernate: select brandpromo0_.bpdbrand_id bpdbrand10_11_1_, brandpromo0_.id id1_, brandpromo0_.bpdcreationdate bpdcreat2_1_, brandpromo0_.id id16_0_, brandpromo0_.bpdbrand_id bpdbrand10_16_0_, brandpromo0_.bpdcreationdate bpdcreat2_16_0_, brandpromo0_.bpdprice bpdprice16_0_, brandpromo0_.bpdpricetype bpdprice4_16_0_, brandpromo0_.bpdpromocreatedby bpdpromo5_16_0_, brandpromo0_.bpdpromodescription bpdpromo6_16_0_, brandpromo0_.bpdpromoname bpdpromo7_16_0_, brandpromo0_.bpdunitprice bpdunitp8_16_0_, brandpromo0_.bpdwompowercondition bpdwompo9_16_0_ wompower.brandpromodetails brandpromo0_ brandpromo0_.bpdbrand_id=?|#] [#|2011-02-23t22:34:04.742+0530|severe|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_threadid=91;_threadname=thread-1;|29930 [http-thread-pool-8080-(1)] warn org.hibernate.util.jdbcexceptionreporter - sql error: 20000, sqlstate: 22005 |#] [#|2011-02-23t22:34:04.742+0530|severe|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_threadid=91;_threadname=thread-1;|29930 [http-thread-pool-8080-(1)] error org.hibernate.util.jdbcexceptionreporter - attempt made data value of type 'java.sql.types 91' data value of type 'int'. |#] [#|2011-02-23t22:34:04.758+0530|severe|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_threadid=91;_threadname=thread-1;|29946 [http-thread-pool-8080-(1)] warn org.hibernate.engine.loading.loadcontexts - fail-safe cleanup (collections) : org.hibernate.engine.loading.collectionloadcontext@a27c32<rs=com.sun.gjc.spi.jdbc40.resultsetwrapper40@184aa30> |#] [#|2011-02-23t22:34:04.758+0530|severe|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_threadid=91;_threadname=thread-1;|29946 [http-thread-pool-8080-(1)] warn org.hibernate.engine.loading.collectionloadcontext - on collectionloadcontext#cleanup, localloadingcollectionkeys contained [1] entries |#] [#|2011-02-23t22:34:04.758+0530|severe|glassfish3.0.1|com.wompower.backing.search.searchregistry|_threadid=91;_threadname=thread-1;|the log message null. com.wompower.entity.accessor.common.entityaccessorexception: org.hibernate.exception.dataexception: not initialize collection: [com.wompower.entity.brand.brand.brandpromodetails#1] @ com.wompower.entity.accessor.common.abstractentityaccessor.dosearchintransaction(abstractentityaccessor.java:137) @ com.wompower.backing.search.searchregistry.getbuysearchresult(searchregistry.java:99) @ com.wompower.backing.search.searchbacking.buysearch(searchbacking.java:65) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:613) @ com.sun.el.parser.astvalue.invoke(astvalue.java:234) @ com.sun.el.methodexpressionimpl.invoke(methodexpressionimpl.java:297) @ com.sun.faces.facelets.el.tagmethodexpression.invoke(tagmethodexpression.java:98) @ com.sun.faces.facelets.tag.jsf.core.declarativesystemeventlistener.processevent(eventhandler.java:121) @ javax.faces.component.uicomponent$componentsystemeventlisteneradapter.processevent(uicomponent.java:2345) @ javax.faces.event.systemevent.processlistener(systemevent.java:102) @ com.sun.faces.application.applicationimpl.processlisteners(applicationimpl.java:1993) @ com.sun.faces.application.applicationimpl.invokecomponentlistenersfor(applicationimpl.java:1941) @ com.sun.faces.application.applicationimpl.publishevent(applicationimpl.java:285) @ com.sun.faces.application.applicationimpl.publishevent(applicationimpl.java:243) @ com.sun.faces.lifecycle.renderresponsephase.execute(renderresponsephase.java:114) @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) @ com.sun.faces.lifecycle.lifecycleimpl.render(lifecycleimpl.java:139) @ javax.faces.webapp.facesservlet.service(facesservlet.java:313) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1523) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:343) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:215) @ org.primefaces.webapp.filter.fileuploadfilter.dofilter(fileuploadfilter.java:79) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:256) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:215) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:277) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:188) @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:641) @ com.sun.enterprise.web.webpipeline.invoke(webpipeline.java:97) @ com.sun.enterprise.web.pesessionlockingstandardpipeline.invoke(pesessionlockingstandardpipeline.java:85) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:185) @ org.apache.catalina.connector.coyoteadapter.doservice(coyoteadapter.java:325) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:226) @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:165) @ com.sun.grizzly.http.processortask.invokeadapter(processortask.java:791) @ com.sun.grizzly.http.processortask.doprocess(processortask.java:693) @ com.sun.grizzly.http.processortask.process(processortask.java:954) @ com.sun.grizzly.http.defaultprotocolfilter.execute(defaultprotocolfilter.java:170) @ com.sun.grizzly.defaultprotocolchain.executeprotocolfilter(defaultprotocolchain.java:135) @ com.sun.grizzly.defaultprotocolchain.execute(defaultprotocolchain.java:102) @ com.sun.grizzly.defaultprotocolchain.execute(defaultprotocolchain.java:88) @ com.sun.grizzly.http.httpprotocolchain.execute(httpprotocolchain.java:76) @ com.sun.grizzly.protocolchaincontexttask.docall(protocolchaincontexttask.java:53) @ com.sun.grizzly.selectionkeycontexttask.call(selectionkeycontexttask.java:57) @ com.sun.grizzly.contexttask.run(contexttask.java:69) @ com.sun.grizzly.util.abstractthreadpool$worker.dowork(abstractthreadpool.java:330) @ com.sun.grizzly.util.abstractthreadpool$worker.run(abstractthreadpool.java:309) @ java.lang.thread.run(thread.java:729) caused by: org.hibernate.exception.dataexception: not initialize collection: [com.wompower.entity.brand.brand.brandpromodetails#1] @ org.hibernate.exception.sqlstateconverter.convert(sqlstateconverter.java:102) @ org.hibernate.exception.jdbcexceptionhelper.convert(jdbcexceptionhelper.java:66) @ org.hibernate.loader.loader.loadcollection(loader.java:2173) @ org.hibernate.loader.collection.collectionloader.initialize(collectionloader.java:62) @ org.hibernate.persister.collection.abstractcollectionpersister.initialize(abstractcollectionpersister.java:627) @ org.hibernate.event.def.defaultinitializecollectioneventlistener.oninitializecollection(defaultinitializecollectioneventlistener.java:83) @ org.hibernate.impl.sessionimpl.initializecollection(sessionimpl.java:1863) @ org.hibernate.collection.abstractpersistentcollection.initialize(abstractpersistentcollection.java:369) @ org.hibernate.collection.abstractpersistentcollection.read(abstractpersistentcollection.java:111) @ org.hibernate.collection.persistentlist.iterator(persistentlist.java:138) @ java.util.abstractcollection.addall(abstractcollection.java:334) @ com.wompower.backing.search.searchregistry$2.execute(searchregistry.java:126) @ com.wompower.backing.search.searchregistry$2.execute(searchregistry.java:1) @ com.wompower.entity.accessor.common.abstractentityaccessor.dosearchintransaction(abstractentityaccessor.java:121) ... 49 more caused by: java.sql.sqldataexception: attempt made data value of type 'java.sql.types 91' data value of type 'int'. @ org.apache.derby.client.am.sqlexceptionfactory40.getsqlexception(unknown source) @ org.apache.derby.client.am.sqlexception.getsqlexception(unknown source) @ org.apache.derby.client.am.resultset.getint(unknown source) @ org.apache.derby.client.am.resultset.getint(unknown source) @ com.sun.gjc.spi.base.resultsetwrapper.getint(resultsetwrapper.java:459) @ org.hibernate.type.descriptor.sql.integertypedescriptor$2.doextract(integertypedescriptor.java:61) @ org.hibernate.type.descriptor.sql.basicextractor.extract(basicextractor.java:64) @ org.hibernate.type.abstractstandardbasictype.nullsafeget(abstractstandardbasictype.java:253) @ org.hibernate.type.abstractstandardbasictype.nullsafeget(abstractstandardbasictype.java:249) @ org.hibernate.type.abstractstandardbasictype.nullsafeget(abstractstandardbasictype.java:229) @ org.hibernate.persister.collection.abstractcollectionpersister.readindex(abstractcollectionpersister.java:768) @ org.hibernate.collection.persistentlist.readfrom(persistentlist.java:402) @ org.hibernate.loader.loader.readcollectionelement(loader.java:1156) @ org.hibernate.loader.loader.readcollectionelements(loader.java:774) @ org.hibernate.loader.loader.getrowfromresultset(loader.java:622) @ org.hibernate.loader.loader.doquery(loader.java:829) @ org.hibernate.loader.loader.doqueryandinitializenonlazycollections(loader.java:274) @ org.hibernate.loader.loader.loadcollection(loader.java:2166) ... 60 more caused by: org.apache.derby.client.am.columntypeconversionexception: attempt made data value of type 'java.sql.types 91' data value of type 'int'. @ org.apache.derby.client.am.cursor.getint(unknown source) ... 76 more |#]
problem onetomany relationship added ordercolumn attribute on date value.. created problem. once removed, worked fine.
Comments
Post a Comment