Issue Details (XML | Word | Printable)

Key: OPENJPA-174
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Jeffrey Blattman
Votes: 0
Watchers: 0
Operations

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

error when find()'ing an abstract class

Created: 19/Mar/07 05:31 PM   Updated: 19/Mar/07 09:47 PM
Return to search
Component/s: None
Affects Version/s: 0.9.6
Fix Version/s: 0.9.7

Time Tracking:
Not Specified

File Attachments:
  Size
Zip Archive abstracttest.zip 2007-03-19 05:37 PM Jeffrey Blattman 23 kB
Zip Archive pom.zip 2007-03-19 05:35 PM Jeffrey Blattman 82 kB
Environment:
Java SE 5
Derby

Resolution Date: 19/Mar/07 09:47 PM


 Description  « Hide
class B extends A
A is abstract
B is concrete

i have persisted an instance of B. now i try:

A a = em.find(A.class, anId);

openjpa fails with:

... Cannot create new application identity instance for abstract class "class A"

if i change the find to:

A a = em.find(B.class, anId);

openjpa works okay.

note that i have two test cases. one is my real model, and one is the simple A and B class example above. my real model fails, where the simple A, B class example works as expected. so, it's is either a side affect of some other issue, or there is something wrong in my model and the error message is misleading or lacking information.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jeffrey Blattman added a comment - 19/Mar/07 05:35 PM
this is a netbeans maven2 project that shows the error. the test case that fails is in PersistTest.java line 61 and 62. 61 fails. 62 succeeds (but is commented out right now.

to run the test case you need a derby network server running on localhost and default port.

Jeffrey Blattman made changes - 19/Mar/07 05:35 PM
Field Original Value New Value
Attachment pom.zip [ 12353670 ]
Jeffrey Blattman added a comment - 19/Mar/07 05:37 PM
this is the simple A, B class test case the works. again, maven2 netbeans projects ... requires derby on localhost:1527 running.

Jeffrey Blattman made changes - 19/Mar/07 05:37 PM
Attachment abstracttest.zip [ 12353672 ]
Repository Revision Date User Message
ASF #520117 Mon Mar 19 21:46:45 UTC 2007 awhite OPENJPA-174 : Remove legacy code throwing an exception when attempting to
construct an oid instance for an abstract persistent type. Improve error
message in ApplicationIds when attempting to create a new id instance when the
id class is abstract.
Files Changed
ADD /incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/AbstractBase.java
MODIFY /incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/util/localizer.properties
MODIFY /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
ADD /incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/ConcreteSubclass.java
MODIFY /incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
MODIFY /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
ADD /incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/TestFindAbstractClass.java

Abe White added a comment - 19/Mar/07 09:47 PM
Only affected abstract base types with a single String id field. Fixed in SVN revision 520117. Added test case in org.apache.openjpa.persistence.inheritance.TestFindAbstractClass.

Abe White made changes - 19/Mar/07 09:47 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 0.9.7 [ 12312340 ]
Resolution Fixed [ 1 ]