DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Unassigned
Reporter: Vito Impagliazzo
Votes: 0
Watchers: 0

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

Subclasses are not loaded correctly

Created: 03/Oct/12 09:56 AM   Updated: 26/Oct/12 05:15 PM   Resolved: 03/Oct/12 10:40 AM
Component/s: Queries
Affects Version/s: 3.1.2
Fix Version/s: None

File Attachments: 1. Zip Archive (4 kB)
2. Zip Archive (4 kB)

Environment: ubuntu, mysql

Datastore: MySQL
Severity: Development

 Description  « Hide
I cannot load properly subclasses. Data is correctly stored in the datastore (mysql), however when querying data is either not found (in one method of the test case) or a field is set improperly to null.
Class structure:
A, A1(subclass of A)
B, B1(subclass of B), B2(subclass of B)
B has a reference to A (one (A) to many (B) relation)

After creating the schema with Schema tool, the first run of the test case goes fine. At second and successive runs however, when data is already present in the database, it does not work. Method getWithSubclasses() fails to find any result. Method getSeparately() finds the result, but field "additional" of class A1 is set to null where it should be "ZZZ"

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 03/Oct/12 10:40 AM

The forum has plenty of references to this and ought to be the first point of call for anyone.

Vito Impagliazzo added a comment - 03/Oct/12 05:35 PM
Thanks for the answer. I have updated the test case. The query now always return something, however fields from the subclasses are still null. as the output says:
--Found: B2: null null A1: a1@a1.a1 a1 true null (when querying the base class)

I have looked in the forums, but could not find similar issues somehow. Please tell me if I should be using the forum instead of jira.

Vito Impagliazzo added a comment - 03/Oct/12 06:17 PM
I found out that fields are not null, if I read them before committing current transaction (in test case, I was not opening and committing explictly the transaction)

Andy Jefferson added a comment - 03/Oct/12 06:24 PM
As is stated in the docs :-

The forum is for you to ask questions, and work out where problems are (with the help of whoever goes on there). "autostart mechanism" questions are all over that forum. As already said, it ought to be the first place that people go, not JIRA.

JIRA is to register demonstratable problems, where something is clearly different to what the JDO or JPA spec says (quoting references to spec sections as to why you think something is different). JIRA is *not* for support.

As for your testcase I don't have time to run every testcase that gets attached here, so you ought to do as the forum posting guide says and debug it with reference to the log etc. If some query returns an object then it utilises some SQL, and gets the object from L1 or L2 caches maybe.