Hi guys.
I'm using a Class call Boom that is persisted using JPA. I have also written DAO classes that implement database access methods for that class. I also use transactions (EJB stateless session beans) to access the dao classes.
One problem that I have been facing is that findById(Long id) returns a not null object, but when I call getId() on that object, it returns null. A little precision, I have declared the id with nullable = false within the Boom class. The most surprising is the fact that, when I call toString() on the return object, the ID is set while at the same time object.getId() returns null.
For example:
Boom object = this.getBoomDAO().findById(anId); System.out.println(object.getId()); System.out.println(object.toString());
Output: null 1023
Best regards.
|