[Hibernate-JIRA] Created: (HB-1565) CLONE -Hibernate 3.1 throws a Null pointer exception when using a regular HQL query to retrieve a persistent instance using a select statement with the classes being packaged in a JAR.
by udd (JIRA)
CLONE -Hibernate 3.1 throws a Null pointer exception when using a regular HQL query to retrieve a persistent instance using a select statement with the classes being packaged in a JAR.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HB-1565
URL: http://opensource.atlassian.com/projects/hibernate/browse/HB-1565
Project: Hibernate2
…
[View More] Type: Bug
Versions: 3.0 rc 1
Environment: Hibernate 3.1, Pointbase
Reporter: udd
I have a web application wherein I make a simple query - select conviction from Conviction conviction with a custom where clause. When there is no matching data, the exception as mentioned below is not thrown but when there is a matching row found, the exception is thrown back. I believe this bug relates to the bug in Hibernate when the classes are packaged in a signed JAR. The only reason I am getting this error is because all my classes are packaged in a JAR file and the same query works when the class is locally used on a command line.
Hibernate: select conviction0_.CONVICTION_ID as CONVICTION1_8_, conviction0_.OFFENSE_COUNTRY as OFFE
NSE2_8_, conviction0_.OFFENSE_STATE as OFFENSE3_8_, conviction0_.OFFENSE_CODE as OFFENSE4_8_, convic
tion0_.OFFENSE_DATE as OFFENSE5_8_, conviction0_.OFFENSE_CITY as OFFENSE6_8_, conviction0_.OFFENSE_C
OUNTY as OFFENSE7_8_, conviction0_.CONVICTION_DATE as CONVICTION8_8_, conviction0_.OFFENSE_CMV as OF
FENSE9_8_, conviction0_.OFFENSE_HAZMAT as OFFENSE10_8_, conviction0_.OFFENSE_CDL as OFFENSE11_8_, co
nviction0_.OFFENSE_ACCIDENT as OFFENSE12_8_, conviction0_.ACCIDENT_SEVERITY as ACCIDENT13_8_, convic
tion0_.ACCIDENT_LOC as ACCIDENT14_8_, conviction0_.ACCIDENT_DATE as ACCIDENT15_8_, conviction0_.CASE
_NO as CASE16_8_, conviction0_.COURT_NAME as COURT17_8_, conviction0_.JOP_PRECINCTNO as JOP18_8_, co
nviction0_.JOP_PLACENO as JOP19_8_, conviction0_.COURT_CITY as COURT20_8_, conviction0_.COURT_COUNTY
as COURT21_8_, conviction0_.DWI_EDINFO as DWI22_8_, conviction0_.DWIED_EXTDATE as DWIED23_8_, convi
ction0_.DRUGED_REQ as DRUGED24_8_, conviction0_.IGNT_INTLCK as IGNT25_8_, conviction0_.COURT_ORDER_N
OENF as COURT26_8_, conviction0_.ACD_DETAIL as ACD27_8_, conviction0_.OUTSTATE_COURT_CITY as OUTSTAT
E28_8_, conviction0_.OUTSTATE_COURT_COUNTY as OUTSTATE29_8_, conviction0_.REP_AGENCY as REP30_8_, co
nviction0_.ENFACTION_BEGDATE as ENFACTION31_8_, conviction0_.ENFACTION_ENDDATE as ENFACTION32_8_, co
nviction0_.STATUS as STATUS8_, conviction0_.NOTICE_DATE as NOTICE34_8_, conviction0_.LIC_SURRENDER a
s LIC35_8_, conviction0_.APPLICANT_ID as APPLICANT36_8_ from CONVICTION conviction0_ where convictio
n0_.APPLICANT_ID=? and conviction0_.OFFENSE_DATE=? and conviction0_.OFFENSE_CODE=? and conviction0_.
OFFENSE_COUNTY=?
java.lang.NullPointerException
at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersiste
r.java:3121)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventL
istener.java:232)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.jav
a:173)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:869)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:838)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
at org.hibernate.type.EntityType.resolve(EntityType.java:303)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2150)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:300)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:146)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1093)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at txdps.dl.bpr.di.data.dao.ConvictionDAO.search(ConvictionDAO.java:87)
at txdps.dl.bpr.di.business.ActionBusiness.search(ActionBusiness.java:18)
at txdps.dl.bpr.di.controller.ConvictionController.getTargetPage(ConvictionController.java:1
59)
at org.springframework.web.servlet.mvc.AbstractWizardFormController.processFormSubmission(Ab
stractWizardFormController.java:503)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(Abstract
FormController.java:256)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.j
ava:139)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControlle
rHandlerAdapter.java:44)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392
)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:357)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.jav
a:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletC
ontext.java:6718)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:37
64)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[View Less]
18 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1846) Collection of subclassed objects includes objects with wrong discriminator type
by Mathieu Veron (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1846?page=c... ]
Mathieu Veron commented on HHH-1846:
------------------------------------
We have the same issue on Hibernate 3.0.5, MySql 4.1.9,
on a very similar mapping,
with a one-to-many default fetch.
In our case a where condition is possible on the set, but is not clean imho.
> Collection of subclassed objects includes objects with wrong discriminator type
> ---------------------------------------------------------…
[View More]----------------------
>
> Key: HHH-1846
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1846
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.3
> Environment: Hibernate 3.1.3, MySQL 4.1.16
> Reporter: Corey Gerritsen
>
>
> We have a class that has a set of a subclass of another class...
> I.e.,
> MyClass.hbm.xml:
> <class name="MyClass" table="myclass">
> ...
> <set name="mySet" table="my_class_link_some_subclass">
> <key column="my_class_id"/>
> <many-to-many column="some_subclass_id" class="SomeSubclass" />
> </set>
> </class>
> /MyClass.hbm.xml
> SomeClass.hbm.xml:
> <class name="SomeClass" table="someclass">
> <id name="id" column="id" type="long">
> <generator class="identity"/>
> </id>
> <discriminator column="type" type="string" />
> ...
> <subclass name="SomeSubclass" discriminator-value="SOMESUBCLASS">
> ...
> </subclass>
> <subclass name="AnotherSubclass" descriminator-value="ANOTHERSUBCLASS">
> ...
> </subclass>
> </class>
> /SomeClass.hbm.xml
> When the many-to-many from MyClass to SomeSubclass is fetch="join" (the default), the Set contains SomeSubclass objects that were initialized by rows with either type='SOMESUBCLASS' or type='ANOTHERSUBCLASS', not only those with type='SOMESUBCLASS'
> This isn't the actual way we found this bug - this also affects caching: we had the collection cached, and when an individual element of the collection expires from the cache, Hibernate tries to reload it by id and descriminator, and can't find elements that shouldn't have been loaded in the first place, throwing, for example, this trace:
> org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [SomeSubclass#42]
> at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
> at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:128)
> at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
> at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
> at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
> at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:830)
> at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
> at org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:177)
> at org.hibernate.collection.PersistentSet.initializeFromCache(PersistentSet.java:101)
> at org.hibernate.cache.entry.CollectionCacheEntry.assemble(CollectionCacheEntry.java:35)
> at org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:130)
> at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:48)
> at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1676)
> at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
> at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
> at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:138)
> ...etc. (we were iterating over the Set of SomeSubclass objects)
> Note that when this happens, SomeClass.mySet contains a reference to a SomeSubclass with id 42, the database has a row in someclass with id = 42 and type = 'ANOTHERSUBCLASS'
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[View Less]
18 years, 5 months
[Hibernate-JIRA] Commented: (HHH-572) Repeated columns rejected in a collection of composite elements
by greg jablonski (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-572?page=co... ]
greg jablonski commented on HHH-572:
------------------------------------
Is there a workaround for the case where you want the many-to-one to be the derived association? I'm trying to do this because my many-to-one is mapped with not-found="ignore", and the property mapping to the same column is that foreign key, and I want to have access to the foreign key value regardless of whether the association is null …
[View More]or not, and a formula won't let me save that property if the many-to-one is null.
What I want to do is this:
<set name="siblings" table="SIBLINGS">
<key column="child_id" />
<composite-element class="Child">
<property name="foo" column="foo">
<property name="siblingId" column="sibling_id" />
<many-to-one name="sibling" column="sibling_id" class="Child" update="false" insert="false" not-found="ignore" />
</composite-element>
</set>
(I realize this looks a little strange, but SIBLING is really a direction-specific many-to-many join table augmented with "foo" in the example case.) Thanks.
> Repeated columns rejected in a collection of composite elements
> ---------------------------------------------------------------
>
> Key: HHH-572
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-572
> Project: Hibernate3
> Type: Bug
> Versions: 3.0.5
> Environment: JRE 1.4.2_08
> Reporter: Emmanuel Bourg
> Assignee: Gavin King
> Priority: Minor
>
>
> Repeating a column in a collection of composite elements triggers an error when the mapping is parsed, even if the property with the repeated column has the insert and update attributes set to false:
> <set name="children" table="CHILDREN">
> <key column="PARENT_ID"/>
> <composite-element class="Child">
> <property name="parentId" column="PARENT_ID" insert="false" update="false" />
> </composite-element>
> </set>
> or
> <set name="roles" table="ROLE">
> <key column="PARENT_ID"/>
> <composite-element class="Role">
> <many-to-one name="child" class="Child"/>
> <property name="childId" column="CHILD_ID" insert="false" update="false" />
> </composite-element>
> </set>
> Hibernate throws this exception:
> org.hibernate.MappingException: Repeated column in mapping for collection: Parent.children column: PARENT_ID
> at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:275)
> at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:298)
> at org.hibernate.mapping.Collection.validate(Collection.java:255)
> at org.hibernate.mapping.Set.validate(Set.java:19)
> at org.hibernate.cfg.Configuration.validate(Configuration.java:817)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:976)
> a workaround is to use a formula:
> <set name="children" table="CHILDREN">
> <key column="PARENT_ID"/>
> <composite-element class="Child">
> <property name="parentId" formula="PARENT_ID"/>
> </composite-element>
> </set>
> This works fine with the fix for HHH-539
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[View Less]
18 years, 5 months