Issue Details (XML | Word | Printable)

Key: NUCRDBMS-252
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Unassigned
Reporter: Andre Schneider
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

JDOUserException if field is null and type of field is abstract.

Created: 31/Aug/09 03:47 PM   Updated: 11/Sep/09 08:41 AM   Resolved: 03/Sep/09 01:25 PM
Component/s: Queries
Affects Version/s: 1.1.4, 1.1.5, 2.0.0.m1
Fix Version/s: 2.0.0.m2

File Attachments: 1. Zip Archive datanucleustest.zip (3 kB)


Datastore: MySQL
Severity: Production


 Description  « Hide
If a field is null and the type of the field is abstract
then datanucleus tries to get the Class for the object although the value is null.
this happens only if you have two abstract classes in your inheritence graph.
Following given objectstructure:
Class A contains a field of class B.
Class B is an abstract class.
Class C is an abstract class and extends B.
Class D extends C and is not abstract.
If you persist an object of type A with a value for field b then everything is ok.
But if you persist an object of type A with no value for field b and you try
to fetch in a new query the object a and try to read field b then follwing Exception
will be thrown although b is null and getB() should return null:
Exception in thread "main" javax.jdo.JDOUserException: Query should return an instance of type "org.datanucleus.test.B" yet this is abstract! Please check your data and model
at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:385)
at org.datanucleus.state.JDOStateManagerImpl.isLoaded(JDOStateManagerImpl.java:1937)
at org.datanucleus.test.A.jdoGetb(A.java)
at org.datanucleus.test.A.getB(A.java:13)
at org.datanucleus.test.Main.main(Main.java:37)
NestedThrowablesStackTrace:
Query should return an instance of type "org.datanucleus.test.B" yet this is abstract! Please check your data and model
org.datanucleus.exceptions.NucleusUserException: Query should return an instance of type "org.datanucleus.test.B" yet this is abstract! Please check your data and model
at org.datanucleus.store.rdbms.query.PersistentIDROF.getObject(PersistentIDROF.java:220)
at org.datanucleus.store.rdbms.fieldmanager.ResultSetGetter.fetchObjectField(ResultSetGetter.java:144)
at org.datanucleus.state.AbstractStateManager.replacingObjectField(AbstractStateManager.java:1182)
at org.datanucleus.test.A.jdoReplaceField(A.java)
at org.datanucleus.test.A.jdoReplaceFields(A.java)
at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2772)
at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2791)
at org.datanucleus.store.rdbms.request.FetchRequest.execute(FetchRequest.java:335)
at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.fetchObject(RDBMSPersistenceHandler.java:240)
at org.datanucleus.state.JDOStateManagerImpl.loadSpecifiedFields(JDOStateManagerImpl.java:1519)
at org.datanucleus.state.JDOStateManagerImpl.isLoaded(JDOStateManagerImpl.java:1925)
at org.datanucleus.test.A.jdoGetb(A.java)
at org.datanucleus.test.A.getB(A.java:13)
at org.datanucleus.test.Main.main(Main.java:37)

Affected Versions: 1.1.4, 1.1.5, 2.0.0.m1


Andre Schneider added a comment - 31/Aug/09 03:48 PM
Testcase

Andre Schneider made changes - 31/Aug/09 03:48 PM
Field Original Value New Value
Attachment datanucleustest.zip [ 11009 ]
Andy Jefferson added a comment - 03/Sep/09 01:25 PM
Doesn't happen for me with SVN trunk

Andy Jefferson made changes - 03/Sep/09 01:25 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 2.0.0.m2 [ 10705 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 11/Sep/09 08:41 AM
Status Resolved [ 5 ] Closed [ 6 ]