openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phill Moran" <pjmo...@rogers.com>
Subject Named query created in error
Date Wed, 18 Apr 2007 19:23:06 GMT
Anyone seen this before?

I have the following named query

@NamedQuery(name = "PersonFXStoreAndLogin", query = "SELECT p FROM Person p
WHERE UPPER(p.store.name) = :storeName and UPPER(p.loginName) = :loginName ORDER
BY p.lastName, p.firstName")

That generated the following SQL statement

SELECT t0.id, t0.lastUpdated, t0.active, t0.activeFrom, t0.activeUntil,
t0.created, t0.displayName, t0.firstName, t0.lastLogin, t0.lastName, t0.locale,
t0.loginName, t0.middleName, t2.id, t2.lastUpdated, t2.description, t3.id,
t3.lastUpdated, t3.description, t2.value, t4.id, t4.lastUpdated, t4.description,
t4.categoryTypeFK, t4.value, t1.id, t1.lastUpdated, t1.created, t1.description,
t1.displayName, t1.name, t5.id, t5.lastUpdated, t5.description,
t5.categoryTypeFK, t5.value, t0.title, t0.visible FROM bidspec.person t0 INNER
JOIN bidspec.manufacturer t1 ON t0.manufacturerFK = t1.id LEFT OUTER JOIN
bidspec.category t2 ON t0.roleFK = t2.id LEFT OUTER JOIN bidspec.category t4 ON
t0.salutationFK = t4.id LEFT OUTER JOIN bidspec.category t5 ON t1.typeFK = t5.id
LEFT OUTER JOIN bidspec.categorytype t3 ON t2.categoryTypeFK = t3.id WHERE
(UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) ORDER BY t0.lastName ASC,
t0.firstName ASC [params=(String) BIDSPEC, (String) PMORAN]

Notice how it is grabbing columns from joined tables. This means it cannot build
the object (Person) I am expecting to get returned and throws an exception. Cool
huh?

My guess is that I should not be drilling down with the "UPPER(p.store.name)"
which is a field within one of these joined tables (t1).

Thoughts?

Phill


Mime
View raw message