Named Queries in Hibernate

Joined
Feb 5, 2009
Messages
1
Reaction score
0
Help!

I have a named query that lives in my .hbm.xml file, and it looks like

<query name="donors.by.donorLevel"><![CDATA[
SELECT
Donor.DonorId,
Donor.FirstName,
Donor.LastName,
Donor.CompanyName,
Donor.Address1,
Donor.Address2,
Donor.City,
Donor.State,
Donor.PostalCode,
Donor.Email,
Donor.PhoneNumber,
Donor.MemberSince
FROM
Donor
LEFT OUTER JOIN (
SELECT
DonorID,
SUM(DonationAmount) AS DonationTotal
FROM
Donation
GROUP BY
DonorID
) DonorDonation
ON Donor.DonorId = DonorDonation.DonorId
LEFT OUTER JOIN DonorLevel
ON ISNULL(DonationTotal, 0) BETWEEN DonorLevel.LowerBoundAmount
AND DonorLevel.UpperBoundAmount
WHERE
DonorLevel.DonationLevelId = ?]]>
</query>

But i'm getting an error, it wont even intitialize. It says there is an error on the LEFT OUTER JOIN ( SELECT...

Any ideas? I'm not writing this in HQL, this is straight up SQL.

Help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top