persistence@glassfish.java.net

Empty references object

From: Dmitry Mozheyko <mozheyko_d_at_mail.ru>
Date: Fri, 26 May 2006 12:08:30 +0400

I use glassfish b48.
I need two classes with unidirectional ManyToOne relation:

Pupil -> Grade

###### Pupil.java ########
...
@Entity
public class Pupil extends Person {
    ...
    @ManyToOne(targetEntity=Grade.class)
    private Grade grade;
    ...
}

When i change Pupil-instance grade attribute from 'A' to 'B' grade attribute in pupil instance, database updates successfully, but grade attribute of Pupil instance contents Grade-class instance with all NULL fields, and
em.createQuery("select o from Grade o where order by o.name").getResultList();
returns Collection with all Grade objects, but on the 'B-object-place' i see object with all fields = null.
i.e.

#########################
id name
 "1" "A"
 "" ""
 "3" "C"
##########################

I tried to run on various platforms and glassfish versions, on JavaDB and PostgreSQL database, various CascadeType's - same result.

When i redeploy my application(or restart server;-)) all is ok.

When is my problem?