-->
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.  [ 5 posts ] 
Author Message
 Post subject: Named SQL query w/ many parameters - parameters not found
PostPosted: Thu Apr 27, 2006 11:03 am 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
Hibernate version: 3.1.3

Mapping documents: Can be provided if needed

Code between sessionFactory.openSession() and session.close():
Query qry = getSession().getNamedQuery("agreementReportDetailQuery");
qry.setParameter("storeId", storeId, Hibernate.STRING);
qry.setParameter("agrStatId", agrStatId, Hibernate.LONG);
qry.setParameter("startLetter", startLetter, Hibernate.STRING);
<<and about 20 more parameters>> ...
return qry.list();

Full stack trace of any exception that occurs:
java.lang.IllegalArgumentException: Parameter startLetter does not exist as a named parameter in [....]
at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:349)
... << now into my DAO code >>

Name and version of the database you are using: DB2/400

The generated SQL (show_sql=true): SQL not generated

I have a very complex SQL query (approx 370 lines) stored as a named query. It uses the DB2 WITH construct (virtual view), many joins, subselects, etc. It accepts 24 named parameters. Some of the named parameters occur multiple times within the query.

This query was working until recently. After creating the Query, I used getQueryString(), but it looks fine (the named parameters are still intact and 'startLetter' is definately in the string). I then dumped the array of named parameters by iterating over qry.getNamedParameters() -- only three named parameters in the array! These three happen to be the first three found in the query string.

We upgraded from 3.0.5 to 3.1.3 about a month ago and this is the first time I have looked at this code since. Has anyone else seen a problem like this?

Curtis ...

_________________
---- Don't forget to rate! ----


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 1:01 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
The <sql-query> would be helpful, can you post that?

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 8:36 am 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
Here is the entire mapping file. As you can see, it is very long and query is very complex - that is why I avoided posting it originally. As I mentioned above, this was working - orginally using 2.1.x and then using 3.0.5.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.xxxxxxx.yyyyyy.persistence.agreement.AgreementReportDetailView">
<composite-id>
<key-property name="agreementId" type="java.lang.Long" />
<key-property name="sku" type="com.xxxxxxx.common.persistence.RWCharStringType" />
</composite-id>
<property name="customerId" update="false" insert="false" type="java.lang.Long" />
<property name="openDate" update="false" insert="false" type="java.util.Date" />
<property name="closeDate" update="false" insert="false" type="java.util.Date" />
<property name="disclosure" update="false" insert="false" type="java.lang.Double" />
<property name="originalWeeks" update="false" insert="false" type="java.lang.Integer" />
<property name="term" update="false" insert="false" type="java.lang.Float" />
<property name="agreementWeeklyRate" update="false" insert="false" type="java.lang.Double" />
<property name="schedule" update="false" insert="false" type="java.lang.Double" />
<property name="lastName" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="firstName" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="mi" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="seniorCode" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="phone" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="address1" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="address2" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="custCity" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="custZipCode" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="custState" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="scheduleText" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="rentalRevenue" update="false" insert="false" type="java.lang.Double" />
<property name="totalPurchaseCost" update="false" insert="false" type="java.lang.Double" />
<property name="rv" update="false" insert="false" type="java.lang.Double" />
<property name="dueDate" update="false" insert="false" type="java.util.Date" />
<property name="lastDate" update="false" insert="false" type="java.util.Date" />
<property name="latePaid" update="false" insert="false" type="java.lang.Double" />
<property name="numberOfDaysLate" update="false" insert="false" type="java.lang.Integer" />
<property name="monthsOpened" update="false" insert="false" type="java.lang.Integer" />
<property name="totalPDateInMonths" update="false" insert="false" type="java.lang.Integer" />
<property name="coverageMethod" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="model" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="vendor" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="purchaseDate" update="false" insert="false" type="java.util.Date" />
<property name="purchaseCost" update="false" insert="false" type="java.lang.Double" />
<property name="bookValue" update="false" insert="false" type="java.lang.Double" />
<property name="itemTypes" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="itemId" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="itemDescription" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="itemSerialNumber" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="itemAddDate" update="false" insert="false" type="java.util.Date" />
<property name="closeReason" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="agreementType" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="routeName" update="false" insert="false" type="com.xxxxxxx.common.persistence.RWCharStringType" />
<property name="lastActivityDate" update="false" insert="false" type="java.util.Date" />
<property name="custMaxDaysLate" update="false" insert="false" type="java.lang.Integer" />
<property name="paidOffDate" update="false" insert="false" type="java.util.Date" />
</class>

<sql-query name="agreementReportDetailQuery">
<![CDATA[
WITH agreementDueDatesForStore AS (
SELECT agreementDueDates.*
FROM
tblAgreementDueDates agreementDueDates
INNER JOIN tblAgreementMaster agreementMaster
ON agreementMaster.pk_AgrMast_Id = agreementDueDates.fk_AgrMast_Id
AND agreementMaster.fk_Store_Id = :storeId
INNER JOIN tblAgreementStatus agreementStatus
ON agreementStatus.fk_AgrMast_Id = agreementMaster.pk_AgrMast_Id
AND agreementStatus.fk_Status_Id = :agrStatId
),
agreementInventoryForStore AS (
SELECT agreementInventory.*
FROM
tblAgreementInventory agreementInventory
INNER JOIN tblAgreementMaster agreementMaster
ON agreementMaster.pk_AgrMast_Id = agreementInventory.fk_AgrMast_Id
AND agreementMaster.fk_Store_Id = :storeId
INNER JOIN tblAgreementStatus agreementStatus
ON agreementStatus.fk_AgrMast_Id = agreementMaster.pk_AgrMast_Id
AND agreementStatus.fk_Status_Id = :agrStatId
)
SELECT
innerQuery.agreementId AS {agrDetail.agreementId},
innerQuery.customerId AS {agrDetail.customerId},
innerQuery.openDate AS {agrDetail.openDate},
innerQuery.closeDate AS {agrDetail.closeDate},
innerQuery.disclosure AS {agrDetail.disclosure},
innerQuery.originalWeeks AS {agrDetail.originalWeeks},
innerQuery.term AS {agrDetail.term},
innerQuery.agreementWeeklyRate AS {agrDetail.agreementWeeklyRate},
innerQuery.schedule AS {agrDetail.schedule},
innerQuery.lastName AS {agrDetail.lastName},
innerQuery.firstName AS {agrDetail.firstName},
innerQuery.mi AS {agrDetail.mi},
innerQuery.seniorCode AS {agrDetail.seniorCode},
innerQuery.address1 AS {agrDetail.address1},
innerQuery.address2 AS {agrDetail.address2},
innerQuery.custCity AS {agrDetail.custCity},
innerQuery.custZipCode AS {agrDetail.custZipCode},
innerQuery.custState AS {agrDetail.custState},
innerQuery.scheduleText AS {agrDetail.scheduleText},
innerQuery.rentalRevenue AS {agrDetail.rentalRevenue},
innerQuery.totalPurchaseCost AS {agrDetail.totalPurchaseCost},
innerQuery.rv AS {agrDetail.rv},
innerQuery.dueDate AS {agrDetail.dueDate},
innerQuery.lastDate AS {agrDetail.lastDate},
innerQuery.latePaid AS {agrDetail.latePaid},
innerQuery.sku AS {agrDetail.sku},
innerQuery.purchaseDate AS {agrDetail.purchaseDate},
innerQuery.model AS {agrDetail.model},
innerQuery.vendor AS {agrDetail.vendor},
innerQuery.purchaseCost AS {agrDetail.purchaseCost},
innerQuery.bookValue AS {agrDetail.bookValue},
innerQuery.itemTypes AS {agrDetail.itemTypes},
innerQuery.itemId AS {agrDetail.itemId},
innerQuery.itemDescription AS {agrDetail.itemDescription},
innerQuery.itemSerialNumber AS {agrDetail.itemSerialNumber},
innerQuery.itemAddDate AS {agrDetail.itemAddDate},
innerQuery.closeReason AS {agrDetail.closeReason},
innerQuery.agreementType AS {agrDetail.agreementType},
innerQuery.routeName AS {agrDetail.routeName},
innerQuery.lastActivityDate AS {agrDetail.lastActivityDate},
innerQuery.paidOffDate AS {agrDetail.paidOffDate},

(CASE
WHEN LENGTH(TRIM(innerQuery.phone)) < 10
THEN
innerQuery.phone
ELSE
'(' ||
SUBSTRING(innerQuery.phone, 0, 4) ||
') ' ||
SUBSTRING(innerQuery.phone, 4, 3) ||
'-' ||
SUBSTRING(innerQuery.phone, 7, 4) ||
(CASE WHEN LENGTH(TRIM(innerQuery.phone)) > 10 THEN ' x' || SUBSTRING(innerQuery.phone, 11) ELSE '' END)
END) AS {agrDetail.phone},

DAYS(CURRENT DATE) - DAYS(innerQuery.dueDate) AS {agrDetail.numberOfDaysLate},

((MONTH(CURRENT DATE) + (YEAR(CURRENT DATE) * 12)) - (MONTH(innerQuery.openDate) + (YEAR(innerQuery.openDate) * 12))) AS {agrDetail.monthsOpened},

(((MONTH(CURRENT DATE) + (YEAR(CURRENT DATE) * 12)) * innerQuery.numberOfItems) - innerQuery.accumMonths) AS {agrDetail.totalPDateInMonths},

(CASE
WHEN innerQuery.custCoverFee IS NOT NULL
THEN 'Club'
WHEN innerQuery.ldw IS NOT NULL
THEN 'LDW'
ELSE 'none'
END) AS {agrDetail.coverageMethod},

0 AS {agrDetail.custMaxDaysLate}

FROM (
SELECT
master.pk_agrMast_id AS agreementId,
master.fk_custMast_id AS customerId,
master.dtOpenDate AS openDate,

detail.decDisclosure AS disclosure,
detail.sintOriginalWeeks AS originalWeeks,
detail.sintTotalPayments AS term,
detail.decAgrDetailWeeklyRate AS agreementWeeklyRate,
detail.decRegularRate AS schedule,
detail.strAgreementItemTypes AS itemTypes,

status.dtCloseDate AS closeDate,

custMaster.strLastName AS lastName,
custMaster.strFirstName AS firstName,
custMaster.strMI AS mi,
srTermId.strShortDescr AS seniorCode,
custMaster.strPrimaryPhone AS phone,

routeMaster.strRouteDescription AS routeName,

custAddress.strAddress1 AS address1,
custAddress.strAddress2 AS address2,
custAddress.city AS custCity,
custAddress.strZipCode AS custZipCode,
custAddress.strStateAbbreviation AS custState,

(CASE
WHEN UPPER(LEFT(schedLang.strDescription, 1)) = 'W'
THEN agrCover.decAgrCoverageWeeklyFee
WHEN UPPER(LEFT(schedLang.strDescription, 1)) = 'B'
THEN agrCover.decAgrCoverageWeeklyFee / 2
WHEN UPPER(LEFT(schedLang.strDescription, 1)) = 'S'
THEN agrCover.decAgrCoverageSemiMonthlyFee
WHEN UPPER(LEFT(schedLang.strDescription, 1)) = 'M'
THEN agrCover.decAgrCoverageMonthlyFee
ELSE
0
END) AS ldw,

invMaster.strType || invMaster.strSubtype || invMaster.PK_INVMAST_ID AS sku,
invMaster.PK_INVMAST_ID AS itemId,
invMaster.dtPurchaseDate AS purchaseDate,
invMaster.strSerialNumber AS itemSerialNumber,
modelMaster.strModelNumber AS model,
modelMaster.strDescription AS itemDescription,
vendor.strVendorCode AS vendor,
gaapDepr.decPurchaseCost AS purchaseCost,
gaapDeprRV.decRV AS bookValue,
agrInv.dtOpenDate AS itemAddDate,
custCover.decCustCoverageWeeklyFee AS custCoverFee,

schedLang.strDescription AS scheduleText,

agrCloseId.strLongDescr AS closeReason,

(CASE
WHEN agrTypeId.strCode IN ('LI', 'LC')
THEN 'Loaner'
ELSE 'Rental'
END) AS agreementType,

DATE((CASE
WHEN a1.FK_AGRMAST_ID IS null
THEN detail.dtInitialDueDate
ELSE a1.dtDueDate
END)) AS dueDate,

DATE((CASE
WHEN a1.FK_AGRMAST_ID IS null
THEN detail.dtInitialDueDate
ELSE a1.dtDueDate
END)) AS lastDate,

(CASE
WHEN (detail.decAgrDetailWeeklyRate IS NOT NULL AND detail.decAgrDetailWeeklyRate > 0)
THEN DATE((CASE WHEN a1.FK_AGRMAST_ID IS null THEN detail.dtInitialDueDate ELSE a1.dtDueDate END)) +
(CEILING((FLOAT(detail.decDisclosure - IFNULL(a2.agrRevenue, 0)) / FLOAT(detail.decAgrDetailWeeklyRate)) * 7)) DAYS
ELSE CURRENT DATE
END) AS paidOffDate,

IFNULL(a2.agrRevenue, 0) AS rentalRevenue,
IFNULL(a4.totalPurchaseCost, 0) AS totalPurchaseCost,
IFNULL(a4.rv, 0) AS rv,
IFNULL(a5.latePaid, 0) AS latePaid,
IFNULL(a6.numberOfItems, 0) AS numberOfItems,
IFNULL(a7.accumMonths, 0) AS accumMonths,

a8.dtCreateDate AS lastActivityDate

FROM
tblAgreementMaster master
INNER JOIN tblAgreementDetail detail ON detail.fk_AgrMast_Id = master.pk_AgrMast_Id
INNER JOIN tblAgreementStatus status
ON status.fk_AgrMast_Id = master.pk_AgrMast_Id
AND status.fk_Status_Id = :agrStatId
INNER JOIN tblCodes agrSubstatId ON agrSubstatId.pk_Code_Id = status.fk_Substatus_Id
INNER JOIN tblCodes agrTypeId ON agrTypeId.pk_Code_Id = status.fk_AgreementCode_Id

INNER JOIN tblCustomerMaster custMaster ON custMaster.pk_CustMast_Id = master.fk_CustMast_Id
INNER JOIN tblCustomerDetail custDetail ON custDetail.fk_CustMast_Id = master.fk_CustMast_Id

INNER JOIN tblScheduleMaster schedMaster ON schedMaster.pk_SchMast_Id = status.fk_Schedule_Id
INNER JOIN tblScheduleLanguage schedLang
ON schedLang.fk_SchMast_Id = schedMaster.pk_SchMast_Id
AND schedLang.fk_Language_Id = :englishLanguageId

LEFT JOIN tblRouteMaster routeMaster ON routeMaster.pk_RtMast_Id = custDetail.fk_RtMast_Id

LEFT JOIN tblCodes srTermId ON srTermId.pk_Code_Id = custMaster.fk_SeniorTerm_Id
LEFT JOIN tblCodes agrCloseId ON agrCloseId.pk_Code_Id = status.fk_CloseCode_Id

LEFT JOIN agreementInventoryForStore AS agrInv ON agrInv.fk_AgrMast_Id = master.pk_AgrMast_Id
LEFT JOIN tblInventoryMaster invMaster ON invMaster.pk_InvMast_Id = agrInv.fk_InvMast_Id
LEFT JOIN tblModelMaster modelMaster ON modelMaster.pk_Model_Id = invMaster.fk_Model_Id
LEFT JOIN tblVendor vendor ON vendor.pk_Vendor_Id = modelMaster.fk_Vendor_Id
LEFT JOIN tblInvGAAPDepr gaapDepr ON gaapDepr.fk_InvMast_Id = invMaster.pk_InvMast_Id
LEFT JOIN tblInvGAAPDeprRV gaapDeprRV ON gaapDeprRV.fk_InvGAAPDepr_Id = gaapDepr.pk_InvGAAPDepr_Id

/* Gets the Customer's Mailing Address */
LEFT JOIN (
SELECT
ca.fk_CustMast_Id, ca.strAddress1, ca.strAddress2,
ca.city, ca.strZipCode, stateMaster.strStateAbbreviation
FROM
tblCustomerAddresses ca
INNER JOIN tblCustomerMaster cm
ON cm.pk_CustMast_Id = ca.fk_CustMast_Id
AND cm.fk_Store_Id = :storeId
INNER JOIN tblStateMaster stateMaster ON stateMaster.pk_StMast_Id = ca.fk_StMast_Id
WHERE ca.fk_AddressType_Id = :primaryAddressTypeId
) custAddress ON custAddress.fk_CustMast_Id = master.fk_CustMast_Id

/* Gets the Agreement Coverage info, if there is any that is Active */
LEFT JOIN (
SELECT
ac.fk_AgrMast_id, ac.decAgrCoverageWeeklyFee,
ac.decAgrCoverageMonthlyFee, ac.decAgrCoverageSemiMonthlyFee
FROM
tblAgreementCoverage ac
INNER JOIN tblAgreementMaster agrMaster
ON agrMaster.pk_AgrMast_Id = ac.fk_AgrMast_Id
AND agrMaster.fk_Store_Id = :storeId
WHERE ac.fk_Status_Id = :activeAgrCoverageId
) agrCover ON agrCover.fk_AgrMast_Id = master.pk_AgrMast_Id

/* Gets the Customer Coverage info, if there is any that is Active */
LEFT JOIN (
SELECT cc.fk_CustMast_Id, cc.decCustCoverageWeeklyFee
FROM
tblCustomerCoverage cc
INNER JOIN tblCustomerMaster cm
ON cm.pk_CustMast_Id = cc.fk_CustMast_Id
AND cm.fk_Store_Id = :storeId
WHERE cc.fk_Status_Id = :activeCustCoverageId
) custCover ON custCover.fk_CustMast_Id = master.fk_CustMast_Id

/* Gets the next Due Date */
LEFT JOIN (
SELECT add2.fk_AgrMast_Id, dtDueDate
FROM
tblAgreementDueDates add2
INNER JOIN (
SELECT
agrDueDates.fk_AgrMast_Id,
MAX(TIMESTAMP(agrDueDates.dtCreateDate)) AS dtCreateDate
FROM
agreementDueDatesForStore AS agrDueDates
GROUP BY agrDueDates.fk_AgrMast_Id
) a1 ON a1.fk_AgrMast_Id = add2.fk_AgrMast_Id AND a1.dtCreateDate = add2.dtCreateDate
) a1 ON a1.fk_AgrMast_Id = master.pk_AgrMast_Id

/* Gets the rental revenue */
LEFT JOIN (
SELECT
fk_AgrMast_Id,
SUM(add.decRentalRevenue + IFNULL(add.decPoaRevenue, 0)) AS agrRevenue
FROM agreementDueDatesForStore AS add
WHERE ((add.decRentalRevenue <> 0) OR (IFNULL(add.decPoaRevenue, 0) <> 0))
GROUP BY add.fk_AgrMast_Id
HAVING (SUM(add.decRentalRevenue + IFNULL(add.decPoaRevenue, 0)) <> 0)
) a2 ON a2.fk_AgrMast_Id = master.pk_AgrMast_Id

/* Gets the agreement remaining value and total purchase cost */
LEFT JOIN (
SELECT
agrInv.fk_AgrMast_Id,
SUM(gaapDepr.decPurchaseCost) AS totalPurchaseCost,
SUM(gaapDeprRV.decRV) AS rv
FROM
tblInvGAAPDeprRV gaapDeprRV
INNER JOIN tblInvGAAPDepr gaapDepr
ON gaapDepr.pk_InvGAAPDepr_Id = gaapDeprRV.fk_InvGAAPDepr_Id
INNER JOIN agreementInventoryForStore AS agrInv
ON agrInv.fk_InvMast_Id = gaapDepr.fk_InvMast_Id
GROUP BY agrInv.fk_AgrMast_Id
) a4 ON a4.fk_AgrMast_Id = master.pk_AgrMast_Id

/* Gets the total late fee paid */
LEFT JOIN (
SELECT dueDate.fk_AgrMast_Id, SUM(rcptDetail.decAmount) AS latePaid
FROM
agreementDueDatesForStore AS dueDate
INNER JOIN tblReceiptDetail rcptDetail
ON rcptDetail.fk_RcptMast_Id = dueDate.fk_RcptMast_Id
INNER JOIN tblReceiptDetailCodes detCodes
ON detCodes.pk_RcptDCodes_Id = rcptDetail.fk_RcptDCodes_Id
WHERE detCodes.strSourceCode = 'PAYLF'
GROUP BY dueDate.fk_AgrMast_Id
) a5 ON a5.fk_AgrMast_Id = master.pk_AgrMast_Id

/* Gets the number of items on the agreement */
LEFT JOIN (
SELECT agrInv.fk_AgrMast_Id, COUNT(*) AS numberOfItems
FROM
agreementInventoryForStore AS agrInv
INNER JOIN tblAgreementStatus status ON agrInv.fk_AgrMast_Id = status.fk_AgrMast_Id
WHERE
(status.fk_Status_Id = :activeAgrStatId AND agrInv.dtCloseDate IS NULL)
OR (status.fk_Status_Id = :inactiveAgrStatId AND agrInv.dtCloseDate = status.dtCloseDate)
GROUP BY agrInv.fk_AgrMast_Id
) a6 ON a6.fk_AgrMast_Id = master.pk_AgrMast_Id

/* Gets the age of the items on the agreement, in months */
LEFT JOIN (
SELECT
agrInv.fk_AgrMast_Id,
SUM(MONTH(invMast.dtPurchaseDate) + (YEAR(invMast.dtPurchaseDate) * 12)) AS accumMonths
FROM
tblInventoryMaster invMast
INNER JOIN agreementInventoryForStore agrInv
ON agrInv.fk_InvMast_Id = invMast.pk_InvMast_Id
INNER JOIN tblAgreementStatus status ON agrInv.fk_AgrMast_Id = status.fk_AgrMast_Id
WHERE
(status.fk_Status_Id = :activeAgrStatId AND agrInv.dtCloseDate IS NULL)
OR (status.fk_Status_Id = :inactiveAgrStatId AND agrInv.dtCloseDate = status.dtCloseDate)
GROUP BY agrInv.fk_AgrMast_Id
) a7 ON a7.fk_AgrMast_Id = master.pk_AgrMast_Id

/* Gets the last activity date */
LEFT JOIN (
SELECT
agrActivity.fk_AgrMast_Id, MAX(TIMESTAMP(agrActivity.dtCreateDate)) AS dtCreateDate
FROM
tblAgreementActivity agrActivity
INNER JOIN tblAgreementMaster agrMaster
ON agrMaster.pk_AgrMast_Id = agrActivity.fk_AgrMast_Id
AND agrMaster.fk_Store_Id = :storeId
GROUP BY agrActivity.fk_AgrMast_Id
) a8 ON a8.fk_AgrMast_Id = master.pk_AgrMast_Id

WHERE
master.fk_Store_Id = :storeId
AND UPPER(LEFT(custMaster.strLastName, 1)) BETWEEN :startLetter AND :endLetter
AND ((status.fk_Status_Id = :activeAgrStatId AND agrInv.dtCloseDate IS NULL)
OR (status.fk_Status_Id = :inactiveAgrStatId AND agrInv.dtCloseDate = status.dtCloseDate))
AND detail.strAgreementItemTypes LIKE :itemType
AND ((:checkForLoaners = 'true' AND agrTypeId.strCode IN ('LI', 'LC')) OR
(:checkForLoaners = 'false' AND NOT agrTypeId.strCode IN ('LI', 'LC')))
AND (:checkRouteId = 'false' OR custDetail.fk_RtMast_Id = :routeId)
AND (:checkFromDate = 'false' OR master.dtOpenDate >= :fromDate)
AND (:checkForPending = 'false' OR agrSubstatId.strCode = 'P')
AND (:checkForReissues = 'false' OR agrSubstatId.strCode IN ('V', 'C'))
) AS innerQuery

WHERE
(:checkExpired = 'false' OR DAYS(CURRENT DATE) - DAYS(innerQuery.dueDate) >= 0)
AND (:checkDueToPay = 'false' OR (innerQuery.dueDate BETWEEN :startDate AND :endDate))
AND (:checkDueToPayWithLate = 'false' OR innerQuery.dueDate <= CURRENT DATE)
AND (:checkPotentialWriteOff = 'false' OR DAYS(VALUE(:endDate, CURRENT DATE)) - DAYS(innerQuery.dueDate) > 90)
AND (:checkDueToPayOff = 'false' OR (innerQuery.paidOffDate BETWEEN :startDate AND :endDate))

]]>
<return alias="agrDetail" class="com.xxxxxxx.yyyyyy.persistence.agreement.AgreementReportDetailView" />
</sql-query>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 9:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
put it in jira but try and see if you can reduce the query to something "smaller" and still tricker the errror - thanks.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 3:52 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
This ended up being a problem with encountering a single apostrophe in an SQL comment. All named parameters after the apostrophe are ignored.

I opened an JIRA issue HHH-1706.

The obvious workaround is to remove single apostrophes from SQL comments.

Thanks to those that looked at this.
Curtis ...

_________________
---- Don't forget to rate! ----


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.