Issue Details (XML | Word | Printable)

Key: OPENJPA-142
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Marc Prud'hommeaux
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
OpenJPA

Entity name is ignored when specified in the orm.xml file

Created: 13/Feb/07 07:58 AM   Updated: 10/Mar/07 11:18 AM
Return to search
Component/s: jpa
Affects Version/s: 0.9.0, 0.9.6
Fix Version/s: 0.9.7

Time Tracking:
Not Specified

File Attachments:
  Size
Zip Archive Licensed for inclusion in ASF works Tests-JPA-1.zip 2007-02-23 10:53 AM Ephemeris Lappis 20 kB

Resolution Date: 10/Mar/07 11:15 AM


 Description  « Hide
The XMLPersistenceMetaDataParser ignores the "name" attriburte of an "entity" element, and instead always uses the default alias. For example, with the following declaration in the orm.xml file:

   <entity name="Foo" class="mypackage.Bar">

the entity will be aliased to "Bar", rather than to "Foo".

Original report by Dain Sundstrom on the open-jpa-dev mailing list:

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:

    <entity name="BasicCmp2Bean" class="org.apache.openejb.test.entity.cmp.BasicCmp2Bean_BasicCmp2Bean">
        <description>BasicCmp2Bean</description>
        <attributes>
            <id name="id"/>
            <basic name="firstName"/>
            <basic name="lastName"/>
        </attributes>
    </entity>


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_AOBasicCmp2Bean],
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_ManyOwningSideBean],
**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_OneOwningSideBean],
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_OneInverseSideBean],
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]}"



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Ephemeris Lappis made changes - 23/Feb/07 10:53 AM
Field Original Value New Value
Attachment Tests-JPA-1.zip [ 12351880 ]
Patrick Linskey made changes - 01/Mar/07 01:12 AM
Fix Version/s 0.9.7 [ 12312340 ]
Patrick Linskey made changes - 10/Mar/07 11:15 AM
Resolution Fixed [ 1 ]
Fix Version/s 0.9.7 [ 12312340 ]
Status Open [ 1 ] Resolved [ 5 ]
Patrick Linskey made changes - 10/Mar/07 11:18 AM
Affects Version/s 0.9.6 [ 12312342 ]
Affects Version/s 0.9.0 [ 12312343 ]
Fix Version/s 0.9.7 [ 12312340 ]