Joined: Wed Oct 06, 2004 2:28 pm Posts: 5
|
I have a SQL
String SQL2 = "select new Integer(L.LossID) from Loss L where L.LossCode = :lossCode";
Query query = (Query)session.createQuery(SQL2)
.setString("lossCode", lossCode);
Integer entityId = (Integer)query.uniqueResult();
This gives QueryException: in expected
Seems like a pretty simple problem. I am trying to resolve this for a few days now. Any help is appreciated.
Thanks.
Hibernate version:
2.1.6
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping auto-import="false" package="com.claimiq.hibernate">
<class lazy="true" name="Loss" table="Loss">
<id column="LossID" name="LossID" type="integer">
<generator class="net.sf.hibernate.id.IdentityGenerator"/>
</id>
<property column="PolicyID" length="10" name="PolicyID" not-null="true" type="integer"/>
<property column="LossState" length="2" name="LossState" not-null="false" type="string"/>
<property column="IsManualSetup" length="1" name="IsManualSetup" not-null="true" type="boolean"/>
<property column="LossDescription" length="255" name="LossDescription" not-null="false" type="string"/>
<property column="LossPaidToDate" length="19" name="LossPaidToDate" not-null="false" type="big_decimal"/>
<property column="StatusID" length="10" name="StatusID" not-null="true" type="integer"/>
<property column="ReportedDate" length="23" name="ReportedDate" not-null="false" type="timestamp"/>
<property column="QuestionGuideID" length="10" name="QuestionGuideID" not-null="false" type="integer"/>
<property column="LossCode" length="40" name="LossCode" not-null="true" type="string"/>
<property column="IncidentDate" length="23" name="IncidentDate" not-null="true" type="timestamp"/>
<property column="LossClosedDate" length="23" name="LossClosedDate" not-null="false" type="timestamp"/>
<property column="ClaimLine" length="1" name="ClaimLine" not-null="false" type="string"/>
<property column="DateLoaded" length="23" name="DateLoaded" not-null="false" type="timestamp"/>
<property column="SpecialHandlingIndicator" length="1" name="SpecialHandlingIndicator" not-null="false" type="string"/>
<property column="UpdateDate" length="23" name="UpdateDate" not-null="false" type="timestamp"/>
<property column="AdjusterEntityID" length="10" name="AdjusterEntityID" not-null="false" type="integer"/>
<property column="ATLASLimit" length="19" name="ATLASLimit" not-null="false" type="big_decimal"/>
<property column="SensitiveClaimIndicator" length="1" name="SensitiveClaimIndicator" not-null="false" type="string"/>
<set inverse="true" name="ClaimSet">
<key column="LossID"/>
<one-to-many class="Claim"/>
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
net.sf.hibernate.QueryException: in expected: L [select new Integer(L.LossID) from Loss L where L.LossCode = :lossCode]
at net.sf.hibernate.hql.FromParser.token(FromParser.java:102)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:294)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1562)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1533)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at net.sf.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:550)
at com.claimiq.hibernate.test.TestCIQHibernate.getEntityIdIfAnyEntityWithSamePartyIdetifierIsPresentInTheLoss(TestCIQHibernate.java:186)
at com.claimiq.hibernate.test.TestCIQHibernate.process(TestCIQHibernate.java:69)
at com.claimiq.hibernate.test.TestCIQHibernate.main(TestCIQHibernate.java:45)
Name and version of the database you are using:
MS SQLServer 2000
The generated SQL (show_sql=true):
select new Integer(L.LossID) from Loss L where L.LossCode = :lossCode
Debug level Hibernate log excerpt:
|
|