Excellent. I added a watch for this issue and will try out the fix
as soon it is available.
In the mean time, I changed my code generator to generate classes
with the exact entity name I want :)
-dain
On Feb 13, 2007, at 12:01 AM, Marc Prud'hommeaux wrote:
Dain-
I've reproduced this problem and reported it at:
https://issues.apache.org/jira/browse/OPENJPA-142
The only workaround is to add the @Entity(name="someAlias")
annotation to the class in addition to specifying it in the orm.xml
file.
On Feb 12, 2007, at 11:49 AM, Dain Sundstrom wrote:
I'm using 0.9.6 and it appears the OpenJPA is ignoring the entity
name when processing queries. In stead it seems to always choose
the class name for the schema name of the bean. For example, I
have the following bean declared in my entity mappings:
class="org.apache.openejb.test.entity.cmp.BasicCmp2Bean_BasicCmp2Bean
">
BasicCmp2Bean
The following query does not work:
SELECT o FROM BasicCmp2Bean o WHERE o.lastName = ?1
But this one does:
SELECT o FROM BasicCmp2Bean_BasicCmp2Bean o WHERE
o.lastName = ?1
When the query fails, I get this message (reformatted a bit with
** added to important entries):
ERROR - The bean instances business method encountered a system
exception: Could not locate metadata for the class using alias
"BasicCmp2Bean". Registered alias mappings: "{
AllowedOperationsCmp2Bean_AOBasicCmp2Bean=
[class
org.apache.openejb.test.entity.cmp.AllowedOperationsCmp2Bean_AOBasicC
mp2Bean],
AllowedOperationsCmpBean=
[class
org.apache.openejb.test.entity.cmp.AllowedOperationsCmpBean],
ContextLookupCmpBean=
[class org.apache.openejb.test.entity.cmp.ContextLookupCmpBean],
Employee=
[class org.apache.openejb.test.entity.cmp2.Employee],
ManyOwningSideBean_ManyOwningSideBean=
[class
org.apache.openejb.test.entity.cmr.cmrmapping.ManyOwningSideBean_Many
OwningSideBean],
**BasicCmp2Bean_BasicCmp2Bean=
[class
org.apache.openejb.test.entity.cmp.BasicCmp2Bean_BasicCmp2Bean],
EncCmpBean=
[class org.apache.openejb.test.entity.cmp.EncCmpBean],
BBean_OneToOneB=
[class
org.apache.openejb.test.entity.cmr.onetoone.BBean_OneToOneB],
OneOwningSideBean_OneOwningSideBean=
[class
org.apache.openejb.test.entity.cmr.cmrmapping.OneOwningSideBean_OneOw
ningSideBean],
ABean_OneToOneA=
[class
org.apache.openejb.test.entity.cmr.onetoone.ABean_OneToOneA],
**BasicCmp2Bean=null,
RmiIiopCmpBean=
[class org.apache.openejb.test.entity.cmp.RmiIiopCmpBean],
ABean_OneToManyA=
[class
org.apache.openejb.test.entity.cmr.onetomany.ABean_OneToManyA],
OneInverseSideBean_OneInverseSideBean=
[class
org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideBean_OneI
nverseSideBean],
BBean_OneToManyB=
[class
org.apache.openejb.test.entity.cmr.onetomany.BBean_OneToManyB],
RmiIiopCmp2Bean_Cmp2_RMI_IIOP_Bean=
[class
org.apache.openejb.test.entity.cmp.RmiIiopCmp2Bean_Cmp2_RMI_IIOP_Bean
],
EncCmp2Bean_EncCmp2Bean=
[class org.apache.openejb.test.entity.cmp.EncCmp2Bean_EncCmp2Bean],
BasicCmpBean=
[class org.apache.openejb.test.entity.cmp.BasicCmpBean]}"
I kind of remember Patrick fixing a bug like this but I couldn't
find the email.
-dain