Fetch Set from DB only works on debug mode

#1

I have a class A, that contains a LinkedHashSet of  another class named B. When I try to fetch that hash set, it returns a null pointer. BUT, when I run the program in debug mode, it works fine!! So I'm almost sure it is a bug? Or maybe something I'm doing wrong?

Here is a test class that shows the problem. (It has 3 files. test<main>, ObjectA, and ObjectB).

Sorry if my english is not perfect. Ask anything.

Thank you. Byee! ;)

#2

Sorry. I didn't had the last version of ObjectDB. Now I updated to 2.7.5_05, but I still having the same problem.

As i'm pretty sure it is a bug, i will open a support ticket.

#3

This is not a bug. Lazily loaded data that has not been loaded before the EntityManager is closed is not available after closing the EntityManager. In debug mode, by examining the set you load the data before closing the EntityManager.

Read about detached entities in the manual and also see the discussion on this issue including the solution in post #3.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#4

Sorry for creating a ticket. I was almost sure it was a bug :P. Thank you for helping, following your advice fixed it. Not is the most eficcent way, but I think still being better than using non-lazy data.


Post Reply

To post a reply and/or subscribe to update notifications - please login