Apache JDO Project - JDOFatalInternalException using single field identity

This is Interesting: Free IT Magazines  
Home > Archive > Apache JDO Project > July 2005 > JDOFatalInternalException using single field identity





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author JDOFatalInternalException using single field identity
Michael Watzek

2005-06-30, 5:45 pm

Hi Erik, Andy,

I have written a test case checking single field identity. For this
purpose, I created new PC classes, new jdo files, new orm files, and I
extended the schema for application identity. When I run the test case,
I get a JDOFatalInternalException from JPOX (see below). Currently, I
run build jpox-20050617.022105.jar.

The exception is thrown when a PC instance is made persistent. I cannot
find an error in the meta data. So, please have a look at the attached
files. I attached the Java file of the PC class and the meta data files.
Is there anything wrong?

Regards,
Michael

testSingleFieldIdentityNotIntializedByte
(org.apache.jdo.tck.api.persistencecapable.NewObjectIdInstance)javax.jdo.JDOFatalInternalException:
Cannot populate the field "id" of class
"org.apache.jdo.tck.pc.singlefieldidentity.PCPointSingleFieldPrimitivebyte"
since it is already populated.
at org.jpox.metadata.FieldMetaData.mergeORMData(FieldMetaData.java:451)
at org.jpox.metadata.ClassMetaData.mergeORMData(ClassMetaData.java:335)
at
org.jpox.metadata.MetaDataManager.addORMDataToClass(MetaDataManager.java:648)
at org.jpox.metadata.ClassMetaData.populate(ClassMetaData.java:395)
at
org.jpox.metadata.MetaDataManager. initialiseMetaDataForClass(MetaDataManag
er.java:948)
at
org.jpox.metadata.MetaDataManager. getParsedMetaDataForClass(MetaDataManage
r.java:423)
at
org.jpox.metadata.MetaDataManager. getMetaDataForClassOrInterface(MetaDataM
anager.java:327)
at
org.jpox.metadata.MetaDataManager.getMetaDataForClass(MetaDataManager.java:285)
at org.jpox.state.StateManagerImpl.<init>(StateManagerImpl.java:558)
at
org.jpox.AbstractPersistenceManager. internalMakePersistent(AbstractPersisten
ceManager.java:973)
at
org.jpox.AbstractPersistenceManager. makePersistent(AbstractPersistenceManage
r.java:1010)
at
org.apache.jdo.tck.api.persistencecapable.PersistenceCapableTest. createPersistentInstances(PersistenceCap
ableTest.java:90)
at
org.apache.jdo.tck.api.persistencecapable.PersistenceCapableTest.localSetUp(PersistenceCapableTest.java:43)
at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:178)
at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:194)
at
org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:128)
at
org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:106)

--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Andy Jefferson

2005-07-01, 5:46 pm

> I have written a test case checking single field identity. For this
> purpose, I created new PC classes, new jdo files, new orm files, and I
> extended the schema for application identity. When I run the test case,
> I get a JDOFatalInternalException from JPOX (see below). Currently, I
> run build jpox-20050617.022105.jar.


I created a testcase doing the same thing :-
* abstract base class with concrete PC class
* specifying the details on JDO and ORM files
as you did and all worked fine. I'm using latest JPOX. Suggest that you try
the latest build of JPOX (http://www.jpox.org/downloads/nightly/)

--
Andy
Java Persistent Objects - JPOX

Michael Watzek

2005-07-05, 7:45 am

Hi Andy,

I sent a patch (Assertion-A7-A8.patch) containg the test case
(NewObjectIdInstance.java) to jdo-dev today. I ran it with JPOX build
"20050628.022915". This seems to be the latest build available under
nightly builds. I still get the exception (see below).

Please have a look at the test case and the meta data, if there is
something wrong.

Regards,
Michael

testSingleFieldIdentityInitializedbyte(o
rg.apache.jdo.tck.api.persistencecapable.NewObjectIdInstance)
javax.jdo.JDOFatalInternalException: Cannot populate the field "id" of
class
"org.apache.jdo.tck.pc.singlefieldidentity.PCPointSingleFieldPrimitivebyte"
since it is already populated.
at org.jpox.metadata.FieldMetaData.mergeORMData(FieldMetaData.java:451)
at org.jpox.metadata.ClassMetaData.mergeORMData(ClassMetaData.java:335)
at
org.jpox.metadata.MetaDataManager.addORMDataToClass(MetaDataManager.java:665)
at org.jpox.metadata.ClassMetaData.populate(ClassMetaData.java:395)
at
org.jpox.metadata.MetaDataManager. initialiseMetaDataForClass(MetaDataManag
er.java:965)
at
org.jpox.metadata.MetaDataManager. getParsedMetaDataForClass(MetaDataManage
r.java:434)
at
org.jpox.metadata.MetaDataManager. getMetaDataForClassOrInterface(MetaDataM
anager.java:338)
at
org.jpox.metadata.MetaDataManager.getMetaDataForClass(MetaDataManager.java:296)
at org.jpox.state.StateManagerImpl.<init>(StateManagerImpl.java:559)
at
org.jpox.AbstractPersistenceManager. internalMakePersistent(AbstractPersisten
ceManager.java:975)
at
org.jpox.AbstractPersistenceManager. makePersistent(AbstractPersistenceManage
r.java:1012)
at
org.apache.jdo.tck.api.persistencecapable.AbstractPersistenceCapableTest. makePersistent(AbstractPersistenceCapabl
eTest.java:21)
at
org.apache.jdo.tck.api.persistencecapable.NewObjectIdInstance. singleFieldIdentityInitialized(NewObject
IdInstance.java:101)
at
org.apache.jdo.tck.api.persistencecapable.NewObjectIdInstance. testSingleFieldIdentityInitializedbyte(N
ewObjectIdInstance.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:203)
at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:128)
at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:106)

>
>
> I created a testcase doing the same thing :-
> * abstract base class with concrete PC class
> * specifying the details on JDO and ORM files
> as you did and all worked fine. I'm using latest JPOX. Suggest that you try
> the latest build of JPOX (http://www.jpox.org/downloads/nightly/)
>



--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Andy Jefferson

2005-07-05, 5:45 pm

> I sent a patch (Assertion-A7-A8.patch) containg the test case
> (NewObjectIdInstance.java) to jdo-dev today. I ran it with JPOX build
> "20050628.022915". This seems to be the latest build available under
> nightly builds. I still get the exception (see below).
>
> Please have a look at the test case and the meta data, if there is
> something wrong.


OK. Please can you point me to instructions on how to run the TCK for a single
test, since things seem to have changed since I was last near it.

--
Andy
Java Persistent Objects - JPOX

Michael Watzek

2005-07-05, 5:45 pm

Hi Andy,

I attached a file (sometests.conf). This is a configuration file
executing only test cases of class "NewObjectIdInstance". You may adapt
the entry "jdo.tck.classes" as appropriate. Please copy this file to
".../tck20/conf", then execute in tck20:

maven -o -Djdo.tck.cfglist=sometests.conf runtck.jdori

This runs the test cases of class "NewObjectIdInstance" for application
identity and datastore identity. The run using application identity
fails with 17 errors. You can ignore the NPEs (6 errors) for now. They
are thrown because the enhanced code passes "null" as arguments to
constructors of SingleIdentity classes.

The remaining 11 errors indicate the problem which I'm interested in. I
attached the log files of those runs for your convenience.

Regards,
Michael


>
>
> OK. Please can you point me to instructions on how to run the TCK for a single
> test, since things seem to have changed since I was last near it.
>



--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Andy Jefferson

2005-07-06, 2:45 am

> This is a configuration file
> executing only test cases of class "NewObjectIdInstance". You may adapt
> the entry "jdo.tck.classes" as appropriate. Please copy this file to
> ".../tck20/conf", then execute in tck20:


Yes, but how do I run a single test ?
I'm not interested in running a block of tests, just one of the failing ones.
For example, how do I run
" testSingleFieldIdentityInitializedIntege
r" ?


--
Andy
Java Persistent Objects - JPOX

Michael Watzek

2005-07-06, 7:45 am

Hi Andy,

>
>
> Yes, but how do I run a single test ?
> I'm not interested in running a block of tests, just one of the failing ones.
> For example, how do I run
> " testSingleFieldIdentityInitializedIntege
r" ?

I think, we do not support this case currently. You can run a single
test class, but you cannot run a single test case if the test class has
several test cases like class "NewObjectIdInstance".

Editting your project.properties file wrt entry "jdo.tck.identitytypes",
you can run class "NewObjectIdInstance" only for application identity.
On my system, this takes less than 10 seconds.

Regards,
Michael
--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Andy Jefferson

2005-07-06, 7:45 am

Hi Michael,

> I think, we do not support this case currently. You can run a single
> test class, but you cannot run a single test case if the test class has
> several test cases like class "NewObjectIdInstance".


OK. I consider it a "must-have". We used to have "runsingle" or something. I
see no Maven goal of this form now. When debugging issues it is essential to
have that. People shouldn't have to run all cases for a particular class and
then find the one they want in the log.

> Editting your project.properties file wrt entry "jdo.tck.identitytypes",
> you can run class "NewObjectIdInstance" only for application identity.
> On my system, this takes less than 10 seconds.


I'll give it a run *when* it's in SVN. Just not got time at the moment for
applying patches etc before I can run it. When will it be in SVN ?


PS. The latest nightly build you were using is not the latest. You need to
look at :-
http://www.jpox.org/downloads/nightly
to get the very latest (SourceForge have changed their logon process so we
can't automatically put our nightly build on their site at the moment).

--
Andy
Java Persistent Objects - JPOX

Michael Watzek

2005-07-06, 7:45 am

Hi Andy,

> Hi Michael,
>
>
>
>
> OK. I consider it a "must-have". We used to have "runsingle" or something. I
> see no Maven goal of this form now. When debugging issues it is essential to
> have that. People shouldn't have to run all cases for a particular class and
> then find the one they want in the log.

The former "runsingle" maven goal is equivalent to running a single
configuration having a single test case with a single identity type. If
you run class "NewObjectIdInstance" with the former "runsingle" goal,
then the same amount of test cases would have been executed.

>
>
> I'll give it a run *when* it's in SVN. Just not got time at the moment for
> applying patches etc before I can run it. When will it be in SVN ?

I'm still busy preparing a patch. I'll send it to jdo-dev today.
Probably, it will be commited by beginning of next week.

Regards,
Michael
>
>
> PS. The latest nightly build you were using is not the latest. You need to
> look at :-
> http://www.jpox.org/downloads/nightly
> to get the very latest (SourceForge have changed their logon process so we
> can't automatically put our nightly build on their site at the moment).
>



--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Craig Russell

2005-07-07, 8:45 pm

Michael Watzek

2005-07-11, 5:45 pm

Hi Andy,

I figured out that the exception below was thrown because I made a
mistake in the orm metadata:

The test case defines a superclass and a subclass. Both are persistence
capable and both define define persistent fields. Mistakenly, I assigned
all column/field mappings to the subclass in the orm metadata. That's
why the exception is thrown.

If I move the fields in the superclass to the subclass, then the test
case succeeds.

I still have a question: Due to the fact that the above use case
indicates an user error, should JPOX throw a JDOFatalUserException
instead of a JDOFatalInternalException?

Regards,
Michael

> Hi Erik, Andy,
>
> I have written a test case checking single field identity. For this
> purpose, I created new PC classes, new jdo files, new orm files, and I
> extended the schema for application identity. When I run the test case,
> I get a JDOFatalInternalException from JPOX (see below). Currently, I
> run build jpox-20050617.022105.jar.
>
> The exception is thrown when a PC instance is made persistent. I cannot
> find an error in the meta data. So, please have a look at the attached
> files. I attached the Java file of the PC class and the meta data files.
> Is there anything wrong?
>
> Regards,
> Michael
>
> testSingleFieldIdentityNotIntializedByte
(org.apache.jdo.tck.api.persistencecapable.NewObjectIdInstance)javax.jdo.JDOFatalInternalException:
> Cannot populate the field "id" of class
> "org.apache.jdo.tck.pc.singlefieldidentity.PCPointSingleFieldPrimitivebyte"
> since it is already populated.
> at org.jpox.metadata.FieldMetaData.mergeORMData(FieldMetaData.java:451)
> at org.jpox.metadata.ClassMetaData.mergeORMData(ClassMetaData.java:335)
> at
> org.jpox.metadata.MetaDataManager.addORMDataToClass(MetaDataManager.java:648)
>
> at org.jpox.metadata.ClassMetaData.populate(ClassMetaData.java:395)
> at
> org.jpox.metadata.MetaDataManager. initialiseMetaDataForClass(MetaDataManag
er.java:948)
>
> at
> org.jpox.metadata.MetaDataManager. getParsedMetaDataForClass(MetaDataManage
r.java:423)
>
> at
> org.jpox.metadata.MetaDataManager. getMetaDataForClassOrInterface(MetaDataM
anager.java:327)
>
> at
> org.jpox.metadata.MetaDataManager.getMetaDataForClass(MetaDataManager.java:285)
>
> at org.jpox.state.StateManagerImpl.<init>(StateManagerImpl.java:558)
> at
> org.jpox.AbstractPersistenceManager. internalMakePersistent(AbstractPersisten
ceManager.java:973)
>
> at
> org.jpox.AbstractPersistenceManager. makePersistent(AbstractPersistenceManage
r.java:1010)
>
> at
> org.apache.jdo.tck.api.persistencecapable.PersistenceCapableTest. createPersistentInstances(PersistenceCap
ableTest.java:90)
>
> at
> org.apache.jdo.tck.api.persistencecapable.PersistenceCapableTest.localSetUp(PersistenceCapableTest.java:43)
>
> at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:178)
> at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:194)
> at
> org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:128)
> at
> org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:106)
>
>
> ------------------------------------------------------------------------
>
> /*
> * Copyright 2005 The Apache Software Foundation.
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
> * You may obtain a copy of the License at
> *
> * http://www.apache.org/licenses/LICENSE-2.0
> *
> * Unless required by applicable law or agreed to in writing, software
> * distributed under the License is distributed on an "AS IS" BASIS,
> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> * See the License for the specific language governing permissions and
> * limitations under the License.
> */
>
> package org.apache.jdo.tck.pc.singlefieldidentity;
>
> import javax.jdo.identity.ByteIdentity;
> import javax.jdo.identity.SingleFieldIdentity;
>
> /**
> * The PC class for testing <code>ByteIdentity</code>.
> * @author Michael Watzek
> */
> public class PCPointSingleFieldPrimitivebyte extends PCPointSingleField {
>
> /**
> * Returns a unique value, used for primary key field initialization.
> * @return a unique value
> */
> private static byte newId() {
> synchronized (PCPointSingleFieldPrimitivebyte.class) {
> return (byte) ((counter++) % Byte.MAX_VALUE);
> }
> }
>
> /**
> * The primary key field.
> */
> private byte id = newId();
>
> /**
> * This constructor is used by test cases checking assertion A7.12-39:<br>
> * The instance returned is initialized with the value of the primary key
> * field of the instance on which the method is called.
> * @param x
> * @param y
> */
> public PCPointSingleFieldPrimitivebyte(int x, int y) {
> super(x, y);
> }
>
> /**
> * Returns <code>true</code> if the given the key of the given
> * <code>SingleFieldIdentity</code> instance equals the key in the subclass
> * of this class.
> * @param singleFieldIdentity the single field identity to check.
> * @return returns <code>true</code> if the given the key of the given
> * <code>SingleFieldIdentity</code> instance equals the key in the subclass
> * of this class.
> */
> public boolean equals(SingleFieldIdentity singleFieldIdentity) {
> return this.id==((ByteIdentity)singleFieldIdentity).getKey();
> }
>
> public String toString() {
> return super.toString() + this.id;
> }
> }
>
>
> ------------------------------------------------------------------------
>
> /*
> * Copyright 2005 The Apache Software Foundation.
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
> * You may obtain a copy of the License at
> *
> * http://www.apache.org/licenses/LICENSE-2.0
> *
> * Unless required by applicable law or agreed to in writing, software
> * distributed under the License is distributed on an "AS IS" BASIS,
> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> * See the License for the specific language governing permissions and
> * limitations under the License.
> */
>
> package org.apache.jdo.tck.pc.singlefieldidentity;
>
> import java.io.Serializable;
> import java.util.Date;
>
> import javax.jdo.identity.SingleFieldIdentity;
>
> /**
> * This is the super class for all PCPoint single indentity classes.
> * It defines an abstract method <code>equals(SingleFieldIdentity)</code>.
> * That method ensures that all single identity test cases have a common
> * implementation.
> * @author Michael Watzek
> */
> abstract public class PCPointSingleField implements Serializable {
>
> /**
> * This field is used by subclasses
> * to compute the value of the primary key field.
> */
> static long counter = new Date().getTime();
>
> public int x;
> public Integer y;
>
> /**
> * This constructor is used by test cases checking assertion A7.12-38:<br>
> * For classes using single field identity method
> * <code>PersistenceCapable.newObjectIdInstance()</code> must be called
> * on a persistent instance with its primary key field initialized,
> * or a JDOFatalInternalException is thrown.
> */
> public PCPointSingleField() {
> }
>
> /**
> * This constructor is used by test cases checking assertion A7.12-39:<br>
> * The instance returned is initialized with the value of the primary key
> * field of the instance on which the method is called.
> * @param x
> * @param y
> */
> public PCPointSingleField(int x, int y) {
> this.x = x;
> this.y = new Integer(y);
> }
>
> /**
> * Returns <code>true</code> if the given the key of the given
> * <code>SingleFieldIdentity</code> instance equals the key in the subclass
> * of this class.
> * @param singleFieldIdentity the single field identity to check.
> * @return returns <code>true</code> if the given the key of the given
> * <code>SingleFieldIdentity</code> instance equals the key in the subclass
> * of this class.
> */
> abstract public boolean equals(SingleFieldIdentity singleFieldIdentity);
>
> public String toString() {
> return '(' + getClass().getName() + ')';
> }
>
> public void setX(int x) {
> this.x = x;
> }
>
> public int getX() {
> return x;
> }
>
> public void setY(Integer y) {
> this.y = y;
> }
>
> public Integer getY() {
> return y;
> }
>
> public String name() {
> return " x: " + getX() + ", y: " + getY().intValue();
> }
> }
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd">
>
> <jdo>
> <package name="org.apache.jdo.tck.pc.singlefieldidentity">
>
> <class name="PCPointSingleFieldPrimitivebyte"
> identity-type="application" objectid-class="javax.jdo.identity.ByteIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldByte"
> identity-type="application" objectid-class="javax.jdo.identity.ByteIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldPrimitivechar"
> identity-type="application" objectid-class="javax.jdo.identity.CharIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldCharacter"
> identity-type="application" objectid-class="javax.jdo.identity.CharIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldPrimitiveint"
> identity-type="application" objectid-class="javax.jdo.identity.IntIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldInteger"
> identity-type="application" objectid-class="javax.jdo.identity.IntIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldPrimitivelong"
> identity-type="application" objectid-class="javax.jdo.identity.LongIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldLong"
> identity-type="application" objectid-class="javax.jdo.identity.LongIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldPrimitiveshort"
> identity-type="application" objectid-class="javax.jdo.identity.ShortIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldShort"
> identity-type="application" objectid-class="javax.jdo.identity.ShortIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> <class name="PCPointSingleFieldString"
> identity-type="application" objectid-class="javax.jdo.identity.StringIdentity">
> <field name="id" primary-key="true"/>
> </class>
>
> </package>
> </jdo>
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE orm PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Mapping Metadata 2.0//EN" "http://java.sun.com/dtd/orm_2_0.dtd">
> <orm>
> <package name="org.apache.jdo.tck.pc.singlefieldidentity">
>
> <class name="PCPointSingleFieldPrimitivebyte" table="PCPointSingleFieldPrimitivebyte">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldByte" table="PCPointSingleFieldByte">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldPrimitivechar" table="PCPointSingleFieldPrimitivechar">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldCharacter" table="PCPointSingleFieldCharacter">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldPrimitiveint" table="PCPointSingleFieldPrimitiveint">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldInteger" table="PCPointSingleFieldInteger">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldPrimitivelong" table="PCPointSingleFieldPrimitivelong">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldLong" table="PCPointSingleFieldLong">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldPrimitiveshort" table="PCPointSingleFieldPrimitiveshort">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldShort" table="PCPointSingleFieldShort">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> <class name="PCPointSingleFieldString" table="PCPointSingleFieldString">
> <field name="id" column="ID" primary-key="true"/>
> <field name="x" column="X"/>
> <field name="y" column="Y"/>
> </class>
>
> </package>
> </orm>
>



--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------

Andy Jefferson

2005-07-11, 5:45 pm

Hi Michael,

> The test case defines a superclass and a subclass. Both are persistence
> capable and both define define persistent fields. Mistakenly, I assigned
> all column/field mappings to the subclass in the orm metadata. That's
> why the exception is thrown.
> If I move the fields in the superclass to the subclass, then the test
> case succeeds.
>
> I still have a question: Due to the fact that the above use case
> indicates an user error, should JPOX throw a JDOFatalUserException
> instead of a JDOFatalInternalException?


Yes. The end result should have been a JDOFatalUserException for the incorrect
metadata spec - and JPOX seems to be totally ignoring this situation
currently, and consequently failing with something else (which is totally
misleading for the user). I'll look into it.

It is, of course, valid to specify the mappings for the superclass fields in
the subclass, but they should then be specified as
"<superclass>.<subclass-field-name>", and the last I looked this was still on
the TODO list for JPOX.


--
Andy
Java Persistent Objects - JPOX

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com