Issue Details (XML | Word | Printable)

Key: NUCRDBMS-533
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Christian Ernst
Votes: 0
Watchers: 0
Operations

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

ghost twin objects returned by Query when using complete-table mapping.

Created: 09/Jun/11 09:30 AM   Updated: 11/Jun/11 03:21 PM   Resolved: 11/Jun/11 03:21 PM
Component/s: ORM
Affects Version/s: 3.0.0.m4
Fix Version/s: None

File Attachments: 1. Zip Archive GhostObjectTwinsOfSubClass.zip (14 kB)


Datastore: MySQL


 Description  « Hide
Ghost twin objects returned by Query when using complete-table.
The twin is a hollow object of the subclass with the same primary oid.
( class part of the datanucleus oid is different)
For each class in the inheritance tree such a ghost twin object gets returned.
----------------
public class A {
private int a;

public void setA(int a) {
this.a = a;
}
}
public class B extends A{

}
-----------------
Properties properties = new Properties();
try {
properties.load(new FileInputStream("datanucleus.properties"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

properties.setProperty("datanucleus.autoCreateSchema", "true");

PersistenceManagerFactory pmf = JDOHelper
.getPersistenceManagerFactory(properties);
PersistenceManager pm = pmf.getPersistenceManager();

JDOPersistenceManagerFactory dpmf = (JDOPersistenceManagerFactory) pmf;
NucleusContext ctx = dpmf.getNucleusContext();
Set classNames = new HashSet();
classNames.add("model.A");
classNames.add("model.B");
try {
((SchemaAwareStoreManager) ctx.getStoreManager()).createSchema(
classNames, properties);
} catch (Exception e) {
e.printStackTrace();
}

Transaction txn = pm.currentTransaction();
txn.begin();

A a = new A();
a.setA(42);
B b = new B();
pm.makePersistent(a);
pm.makePersistent(b);

txn.commit();

pm.close();
pmf.close();
pmf = JDOHelper
.getPersistenceManagerFactory(properties);
pm = pmf.getPersistenceManager();

txn = pm.currentTransaction();
txn.begin();

Query qry = pm.newQuery(A.class,"a == param");
qry.declareParameters("int param");
Collection<A> res = (Collection<A>) qry.execute(new Integer(42));

for (A aa : res) {
System.out.println(pm.getObjectId(aa));
assertEquals(A.class,aa.getClass());
}

txn.commit();
-----------------








Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 10/Jun/11 10:51 AM
Presume you mean 3.0-m4 since unreleased software doesn't exist yet.

Christian Ernst added a comment - 10/Jun/11 10:55 AM - edited
Correctly is actually 3.0.0.m5 snapshot.
I was testing if the fix for (NUCRDBMS-527) solves my problems to get Datanucleus to work with the latest Poleposition benchmark ( http://www.polepos.org/)


Andy Jefferson added a comment - 10/Jun/11 11:00 AM
As in JIRA front page, we do not accept issues marked against unreleased software since its a daft concept. Bug in and fixed in are used for release notes, so no point in issues showing up as "bug in" version X and "fixed in" version X.

If you have an issue with the fix to NUCRDBMS-527 then raise it against that and I'll reopen it.

Christian Ernst added a comment - 10/Jun/11 11:10 AM
I wanted only to help you by testing the unreleased fix (NUCRDBMS-527) already with my application before 3.0.0.m5 is released and stumbled over a new problem.
So how shall i file such kind of bugs ?
Always as part of the original bug ? Or do i have to wait for the official release ?


Andy Jefferson added a comment - 10/Jun/11 01:05 PM
As already said, the original issue is the place to put anything during a development cycle. Thx
PS, please look at http://www.datanucleus.org/project/problem_reporting.html which defines an accepted testcase for JDO and JPA. I simply don't have time to accept anything else and have to massage it into that form

Andy Jefferson added a comment - 11/Jun/11 03:21 PM