]
Gail Badner commented on HHH-2828:
----------------------------------
Thanks for the reminder, Tim. we'll keep it in mind when this gets worked on.
criteria search by class throws org.hibernate.QueryException:
Unsupported discriminator type null when mapping exists for this class
-------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2828
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2828
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Environment: hibernate 3.2.5, oracle 10g
Reporter: jo desmet
Attachments: src.zip
when making a criteria based on a property of type class the query succeeds if this class
is not mapped, the query building fails when this class is mapped within hibernate and has
no discriminator
e.g. code :
Criteria l = session.createCriteria(SearchClass.class);
l.add(Restrictions.eq("type", ClassWithNoMapping.class)); //
SUCCESS
java.util.List result = l.list();
l = session.createCriteria(SearchClass.class);
l.add(Restrictions.eq("type", ClassWithMapping.class)); //
EXCEPTION
result = l.list();
exception is
Hibernate: select this_.ID as ID0_0_, this_.name as name0_0_, this_.type as type0_0_ from
SEARCHCLASS this_ where this_.type=?
org.hibernate.QueryException: Unsupported discriminator type null
at
org.hibernate.loader.criteria.CriteriaQueryTranslator.getTypedValue(CriteriaQueryTranslator.java:499)
at org.hibernate.criterion.SimpleExpression.getTypedValues(SimpleExpression.java:71)
at
org.hibernate.loader.criteria.CriteriaQueryTranslator.getQueryParameters(CriteriaQueryTranslator.java:251)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at Test.list(Test.java:40)
at Test.main(Test.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
classes are attached, tables should exists but no data is required.
Please also provide workaround on short term if possible
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: