-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: org.hibernate.QueryException
PostPosted: Tue Aug 08, 2006 8:45 pm 
Newbie

Joined: Fri Jul 07, 2006 9:36 am
Posts: 15
Hi,

I am having trouble with an HQL query. First let me say I am not sure if the query is functionally correct, but I do not get to that point. I am getting a "could not resolve property" error.
I have attached all of the relevant materials below.
Any help is greatly appreciated.

P.S. I am trying to do a "not exists" in the query below. I am not sure if it is correct. Any help with the query is also appreciated.



Hibernate version:
3.1.3

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="us.nc.state.doc.ws.hibernate.bean.acd.Acdt1aa1" table="ACDT1AA1" schema="HZAZDB3">
<composite-id name="id" class="us.nc.state.doc.ws.hibernate.bean.acd.Acdt1aa1Id">
<key-property name="cmdornum" type="string">
<column name="CMDORNUM" length="7" />
</key-property>
<key-property name="cffaclid" type="string">
<column name="CFFACLID" length="5" />
</key-property>
<key-property name="cfpgmid" type="string">
<column name="CFPGMID" length="6" />
</key-property>
<key-property name="actysect" type="string">
<column name="ACTYSECT" length="3" />
</key-property>
<key-property name="acbegdte" type="date">
<column name="ACBEGDTE" length="10" />
</key-property>
</composite-id>
<property name="acinmsta" type="string">
<column name="ACINMSTA" length="1" not-null="true" />
</property>
<property name="acgrpid" type="string">
<column name="ACGRPID" length="3" not-null="true" />
</property>
<property name="acphsid" type="string">
<column name="ACPHSID" length="3" not-null="true" />
</property>
<property name="acconslr" type="string">
<column name="ACCONSLR" length="5" not-null="true" />
</property>
<property name="acprend" type="date">
<column name="ACPREND" length="10" not-null="true" />
</property>
<property name="acdisdte" type="date">
<column name="ACDISDTE" length="10" not-null="true" />
</property>
<property name="acdisrsn" type="string">
<column name="ACDISRSN" length="3" not-null="true" />
</property>
<property name="acdisstf" type="string">
<column name="ACDISSTF" length="5" not-null="true" />
</property>
<property name="cmresstr" type="string">
<column name="CMRESSTR" length="30" not-null="true" />
</property>
<property name="cmcity" type="string">
<column name="CMCITY" length="20" not-null="true" />
</property>
<property name="cmstate" type="string">
<column name="CMSTATE" length="2" not-null="true" />
</property>
<property name="cmzip" type="string">
<column name="CMZIP" length="9" not-null="true" />
</property>
<property name="acdisphn" type="string">
<column name="ACDISPHN" length="10" not-null="true" />
</property>
<property name="dtofupdt" type="date">
<column name="DTOFUPDT" length="10" not-null="true" />
</property>
<property name="tmofupdt" type="time">
<column name="TMOFUPDT" length="8" not-null="true" />
</property>
<property name="stfofupdt" type="string">
<column name="STFOFUPDT" length="5" not-null="true" />
</property>
<property name="acdpgmid" type="string">
<column name="ACDPGMID" length="2" not-null="true" />
</property>
<many-to-one name="appt7aa1" class="us.nc.state.doc.ws.hibernate.bean.pp.Appt7aa1" unique="true" lazy="no-proxy" insert="false" update="false">
<column name="CMDORNUM"></column>
</many-to-one>
</class>
</hibernate-mapping>



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping package="us.nc.state.doc.ws.hibernate.bean.pp">
<class name="Appt7aa1" table="APPV7AA1">
<id name="offenderNumber" type="string" column="CDDORNUM" length="7">
<generator class="assigned"></generator>
</id>
<property name="lastName" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDSLSTNM" length="20" not-null="true" />
<property name="firstName" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDSFSTNM" length="11" not-null="true" />
<property name="middleInitial" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDSMIDNM" length="15" not-null="true" />
<property name="suffix" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDSSUFFX" length="3" not-null="true" />
<property name="sex" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDCLSEX" length="1" not-null="true" />
<property name="race" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDCLRACE" length="1" not-null="true" />
<property name="birthDate" type="date" column="CDCLBRTH" length="10" not-null="true" />
<property name="recordStatusCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="PPRCDSTA" length="1" not-null="true" />
<property name="adminStatusCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="GDSTATUS" length="2" not-null="true" />
<property name="judicialDistrict" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="JUDIDIST" length="5" not-null="true" />
<property name="judicialDivision" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDRNUM" length="5" not-null="true" />
<property name="officeCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDPPSLOC" length="5" not-null="true" />
<property name="countyOfSupervision" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDCTYSUP" length="2" not-null="true" />
<property name="ppOfficerId" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDOFICER" length="5" not-null="true" />
<property name="chiefPPOfficer" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CHIEFPPO" length="5" not-null="true" />
<property name="supervisionGainLossDate" type="date" column="SUPVGLDT" length="10" not-null="true" />
<property name="caseLoadGainLossCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="GDGLCODE" length="3" not-null="true" />
<property name="supervisionTypeCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="SUPVTYPE" length="2" not-null="true" />
<property name="riskAssessmentLevel" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDRISKCL" length="1" not-null="true" />
<property name="oldestCaseCurrentPeriod" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDOLDPFX" length="2" not-null="true" />
<property name="oldestCrimeCurrentPeriod" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDOLDCMP" length="3" not-null="true" />
<property name="countyOfOriginalSentence" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDCTYORI" length="2" not-null="true" />
<property name="mostSeriousOffenseCurrentPeriod" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="PRIOFFNSE" length="4" not-null="true" />
<property name="felonyMisdInd" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDFELONY" length="1" not-null="true" />
<property name="punishmentType" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="SNTPUNTY" length="1" not-null="true" />
<property name="beginDateOfSupervision" type="date" column="CDBGDTSP" length="10" not-null="true" />
<property name="lengthOfSupervision" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDSUPLTH" length="7" not-null="true" />
<property name="supervisionTerminationDate" type="date" column="CDSSTMDT" length="10" not-null="true" />
<property name="interstateCompactCaseCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="DDINSTNO" length="1" not-null="true" />
<property name="currentPPCase" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDPREFX2" length="2" not-null="true" />
<property name="currentPPCrimeCurrPeriod" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDCURCMP" length="3" not-null="true" />
<property name="finalRunlingPPCase" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDRULPFX" length="2" not-null="true" />
<property name="finalRunlingPPCrime" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDRULCMP" length="3" not-null="true" />
<property name="pendingViolations" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDPENVIO" length="1" not-null="true" />
<property name="vistimNotificationInd" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="NOTIFY" length="1" not-null="true" />
<property name="extraditionStatus" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="EXTRSTAT" length="1" not-null="true" />
<property name="dateOfUpdate" type="date" column="DTOFUPDT" length="10" not-null="true" />
<property name="timeOfUpdate" type="time" column="TMOFUPDT" length="8" not-null="true" />
<property name="staffOfUpdate" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="STFOFUPDT" length="5" not-null="true" />
<property name="currentStateOwningCase" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CURSTATE" length="2" not-null="true" />
<property name="earliestConvictionDate" type="date" column="PPCONVDT" length="10" not-null="true" />
<property name="latestGainLossReasonCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="PPGLRSN" length="2" not-null="true" />
<property name="latestRiskAssessmentDate" type="date" column="RSKASMDT" length="10" not-null="true" />
<property name="latestRiskAssessmentReason" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="RSKASMRSN" length="1" not-null="true" />
<property name="latestprogressReportDate" type="date" column="PRGRPTDT" length="10" not-null="true" />
<property name="latestprogressReportType" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="PRGRPTYP" length="1" not-null="true" />
<property name="latestprogressReportStatus" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="PRGRPTSTA" length="1" not-null="true" />
<property name="totalNbrOfSupervisorTerms" type="java.lang.Long" column="TOTSUPCMP" precision="4" scale="0" not-null="true" />
<property name="timeCompStatusCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="PPTMCOMP" length="1" not-null="true" />
<property name="latestCaseReviewDate" type="date" column="CRLSTDTE" length="10" not-null="true" />
<property name="latestCaseReviewTypeCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CRLSTCDE" length="2" not-null="true" />
<property name="nextCaseReviewDate" type="date" column="CRNXTDTE" length="10" not-null="true" />
<property name="nextCaseReviewTypeCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CRNXTCDE" length="2" not-null="true" />
<property name="sexOffenderCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="SEXOFNDR" length="1" not-null="true" />
<property name="randomReviewCode" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CDRVWCDE" length="1" not-null="true" />
<property name="randomReviewScheduleDate" type="date" column="CDRVWSDT" length="10" not-null="true" />
<property name="randomReviewCompletedDate" type="date" column="CDRVWCDT" length="10" not-null="true" />
<property name="dccStaffWorkAssignment" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="DCCSTFWKA" length="3" not-null="true" />
<property name="dccPunishmentType" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="DCCPUNTYP" length="1" not-null="true" />
<property name="dccSeriousOffenseCurrPeriod" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="DCCOFFNSE" length="4" not-null="true" />
<property name="ctgAffiliationFlag" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CTGFLAG" length="1" not-null="true" />
<property name="courtesyOfficerId" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CRTOFF" length="5" not-null="true" />
</class>
</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping package="us.nc.state.doc.ws.hibernate.bean.offender">
<class name="Ofnt4bq1" table="OFNV4BQ1">
<composite-id name="id" class="Ofnt4bq1Id">
<key-property name="offenderNumber" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CMDORNUM" length="7" />
<key-property name="testType" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITESTYP" length="4" />
<key-property name="testDate" type="date" column="CITESTDT" length="10" />
</composite-id>
<property name="testingFacilityId" type="string" column="CITSTLOC" length="5" not-null="true" />
<property name="conditionDuringTest" type="string" column="CITSTCND" length="1" not-null="true" />
<property name="testingLevel" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSTLVL" length="2" not-null="true" />
<property name="testForm" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSTFRM" length="2" not-null="true" />
<property name="testScore01" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC01" length="4" not-null="true" />
<property name="testScore02" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC02" length="4" not-null="true" />
<property name="testScore03" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC03" length="4" not-null="true" />
<property name="testScore04" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC04" length="4" not-null="true" />
<property name="testScore05" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC05" length="4" not-null="true" />
<property name="testScore06" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC06" length="4" not-null="true" />
<property name="testScore07" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC07" length="4" not-null="true" />
<property name="testScore08" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC08" length="4" not-null="true" />
<property name="testScore09" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC09" length="4" not-null="true" />
<property name="testScore10" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC10" length="4" not-null="true" />
<property name="testScore11" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC11" length="4" not-null="true" />
<property name="testScore12" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC12" length="4" not-null="true" />
<property name="testScore13" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC13" length="4" not-null="true" />
<property name="testScore14" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC14" length="4" not-null="true" />
<property name="testScore15" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC15" length="4" not-null="true" />
<property name="testScore16" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC16" length="4" not-null="true" />
<property name="testScore17" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC17" length="4" not-null="true" />
<property name="testScore18" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC18" length="4" not-null="true" />
<property name="testScore19" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC19" length="4" not-null="true" />
<property name="testScore20" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC20" length="4" not-null="true" />
<property name="testScore21" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC21" length="4" not-null="true" />
<property name="testScore22" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSSC22" length="4" not-null="true" />
<property name="dateOfUpdate" type="date" column="DTOFUPDT" length="10" not-null="true" />
<property name="timeOfUpdate" type="time" column="TMOFUPDT" length="8" not-null="true" />
<property name="staffOfUpdate" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="STFOFUPDT" length="5" not-null="true" />
<property name="testVersion" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITSTVER" length="2" not-null="true" />
</class>
<query name="findByOffenderNbrAndTestType">
<![CDATA[
FROM Ofnt4bq1
WHERE cmdornum = :offenderNumber
AND citestyp = :testType
]]>
</query>
<query name="findByOffenderNbrTestTypeAdmDteAndTestDt">
<![CDATA[
FROM Ofnt4bq1
WHERE cmdornum = :offenderNumber
AND citestyp = :testType
AND citestdt >= :admdte
AND citestdt = :citestdt
]]>
</query>
</hibernate-mapping>




Code between sessionFactory.openSession() and session.close():

/**
* @param p_strOffenderNbr
* @param p_strStatus
* @return List
*/
public List findByOffenderNbrAndStatusForCherry(String p_strOffenderNbr, String p_strStatus) {
try {

StringBuffer sb = new StringBuffer();
sb
.append("FROM Acdt1aa1 acdt1aa1 ")
.append(" WHERE acdt1aa1.ACINMSTA = :offenderStatus ")
.append(" AND NOT EXISTS ( FROM Ofnt4bq1 ofnt4bq1 ")
.append(" WHERE ofnt4bq1.CMDORNUM = acdt1aa1.CMDORNUM ")
.append(" AND ofnt4bq1.citestyp = :testType ) ");
Query query = getSession().createQuery(sb.toString());
query.setParameter("offenderStatus", p_strStatus);
query.setParameter("testType", "0017");
return query.list();
} catch (RuntimeException re) {
LogService.logError("find by property name failed", re);
throw re;
}
}


Full stack trace of any exception that occurs:

org.hibernate.QueryException: could not resolve property: ACINMSTA of: us.nc.state.doc.ws.hibernate.bean.acd.Acdt1aa1 [FROM us.nc.state.doc.ws.hibernate.bean.acd.Acdt1aa1 acdt1aa1 WHERE acdt1aa1.ACINMSTA = :offenderStatus AND NOT EXISTS ( FROM us.nc.state.doc.ws.hibernate.bean.offender.Ofnt4bq1 ofnt4bq1 WHERE ofnt4bq1.CMDORNUM = acdt1aa1.CMDORNUM AND ofnt4bq1.citestyp = :testType ) ]
at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1265)
at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:279)
at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:372)
at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:539)
at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:221)
at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:172)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:90)
at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:725)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1215)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3518)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583)
at us.nc.state.doc.ws.hibernate.dao.acd.Acdt1aa1DAO.findByOffenderNbrAndStatusForCherry(Acdt1aa1DAO.java:90)
at us.nc.state.doc.ws.support.facade.acd.AcdFacade.retrieveAlcoholChemicalDependency(AcdFacade.java:74)
at us.nc.state.doc.services.acd.AcdWebService.AlcoholChemicalDependencyInquire(AcdWebService.java:101)
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:324)
at us.nc.state.doc.receivers.DocSOAPXMLInOutMessageReceiver.invokeBusinessLogic(DocSOAPXMLInOutMessageReceiver.java:112)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:504)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:144)
at us.nc.state.doc.servlet.ImplAxis2Servlet.doPost(ImplAxis2Servlet.java:104)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)


Name and version of the database you are using:
DB2 version 8

The generated SQL (show_sql=true):
FROM us.nc.state.doc.ws.hibernate.bean.acd.Acdt1aa1 acdt1aa1 WHERE acdt1aa1.ACINMSTA = :offenderStatus AND NOT EXISTS ( FROM us.nc.state.doc.ws.hibernate.bean.offender.Ofnt4bq1 ofnt4bq1 WHERE ofnt4bq1.CMDORNUM = acdt1aa1.CMDORNUM AND ofnt4bq1.citestyp = :testType )

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 9:38 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Not exists is fine.

You have called the property "acinmsta", not "ACINMSTA". Use the property name in the query, not the column name.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 9:56 pm 
Newbie

Joined: Fri Jul 07, 2006 9:36 am
Posts: 15
Hi tenwit,

Thanks. I will give it a try.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 10:23 pm 
Newbie

Joined: Fri Jul 07, 2006 9:36 am
Posts: 15
Hi tenwit,

I tried your solution and it did work, some what. I am now having the same problem with the Ofnt4bq1 mapping. I tried using the "offenderNumber" property, no luck.
I get the following error.

org.hibernate.QueryException: could not resolve property: offenderNumber of: us.nc.state.doc.ws.hibernate.bean.offender.Ofnt4bq1 [FROM us.nc.state.doc.ws.hibernate.bean.acd.Acdt1aa1 acdt1aa1 WHERE acdt1aa1.acinmsta = :acinmsta AND NOT EXISTS ( FROM us.nc.state.doc.ws.hibernate.bean.offender.Ofnt4bq1 ofnt4bq1 WHERE ofnt4bq1.offenderNumber = acdt1aa1.cmdornum AND ofnt4bq1.testType = :testType ) ]

I have had a similar problem in the past and I have used the column name as a work around. It did not work in this case.

It always seems to be a problem when the proerty/column are part of a composite key.

Any ideas ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 10:45 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
offenderNumber isn't a property, it's part of an id. Use "id.offenderNumber". If you had called your id "x", you could use "id.offenderNumber" or "x.offenderNumber". As it is, you have to use id.offenderNumber.

I think that I read something about accessing composite-id fields in HQL not working. If you can't get it to work here, you should search JIRA for something about this.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 9:04 am 
Newbie

Joined: Fri Jul 07, 2006 9:36 am
Posts: 15
Hi tenwit,

Thank you.
I will give it a try. If it does not work out I will check JIRA.
Thank you again!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 9:22 am 
Newbie

Joined: Fri Jul 07, 2006 9:36 am
Posts: 15
Hi tenwit,

That worked.
Thank you !


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 9:25 am 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
Code:
<class name="Ofnt4bq1" table="OFNV4BQ1">
   <composite-id name="id" class="Ofnt4bq1Id">
      <key-property name="offenderNumber" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CMDORNUM" length="7" />
      <key-property name="testType" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITESTYP" length="4" />
      <key-property name="testDate" type="date" column="CITESTDT" length="10" />
   </composite-id>
   ...
   ...
</class>


Instead of having mapping as above, try to make minor changes in your mapping(shown below) so that it makes your life easier.

Code:
<class name="Ofnt4bq1" table="OFNV4BQ1">
   <composite-id>
      <key-property name="offenderNumber" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CMDORNUM" length="7" />
      <key-property name="testType" type="us.nc.state.doc.ws.core.hibernate.usertypes.TrimedStringUserType" column="CITESTYP" length="4" />
      <key-property name="testDate" type="date" column="CITESTDT" length="10" />
   </composite-id>
   ...
   ...
</class>


and make your original class Ofnt4bq1 extend Ofnt4bq1Id. Super class has defined all the properties of composite-id element i.e. offenderNumber, testType, testDate similar to your existing implementation.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 9:29 am 
Newbie

Joined: Fri Jul 07, 2006 9:36 am
Posts: 15
Hi bkmr_77,

Thank you for the suggestion.
I will look into the possibility going forward.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.