-----Original Message-----
From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
To: persistence_at_glassfish.dev.java.net
Date: Tue, 06 Jun 2006 23:15:34 -0700
Subject: Re: Empty references object
>
> Dmitry,
>
> Can you try
> a) to use the latest build?
use Sun-distributed build "Java EE 5 SDK First Customer Ship for Solaris SPARC"
Sun Java System Application Server Platform Edition 9.0 (build b48)
> b) change the inheritance strategy to the default (SINGLE_TABLE), and if needed
> use java2db (auto DDL generation) to avoid changing your schema?
I change inheritance strategy to SINGLE_TABLE and deploy with Derby database -
SAME RESULT :(
>
> Also, is @Id correctly defined on the VersionControl class?
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class VersionControl implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
...
>
> thanks,
> -marina
>
> Dmitry Mozheyko wrote:
> >
> >
> > -----Original Message-----
> > From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
> > To: persistence_at_glassfish.dev.java.net
> > Date: Tue, 06 Jun 2006 13:48:49 -0700
> > Subject: Re: Empty references object
> >
> >
> >>Dmitry,
> >>
> >>Can you please provide more details? What does it mean "on the 'B-object-place'
> >>i see object with all fields = null"?
> >
> >
> > Yes, all field including primary key are == null, and "findAll" method of Grade-class return collection with grades, but on referenced place stay "empty"(with all nulled fields) object.
> >
> >
> >>What fields does your Grade object have?
> >
> >
> > All inherited from VersionControl(
> > Long id;
> > @Temporal(TemporalType.TIMESTAMP)
> > Date versionId;
> > String editorName;
> > Boolean isActual;
> > Long objectId;
> > );
> >
> > and one self-own field
> >
> > String name;
> >
> >
> >>Is VersionControl also an entity or a MappedSuperClass?
> >
> >
> > Also entity:
> > @Entity
> > @Inheritance(strategy=InheritanceType.JOINED)
> >
> >
> >>The restart that you perform cleans up the in-memory cache of the objects
> >>accessed by this PU before.
> >
> >
> > Disable/Enable enterprise application from AdminConsole also helped.
> >
> >
> >>Do you have any ideas/clues what could've caused
> >>this instance to have all fields null in memory?
> >
> >
> > NO! I don't have code that can do this.
> >
> > May be i forget any important annotations with this intricate inheritance?
> >
> >
> >
> >>thanks,
> >>-marina
> >>
> >>Dmitry Mozheyko wrote:
> >>
> >>>-----Original Message-----
> >>>From: "Gordon Yorke" <gordon.yorke_at_oracle.com>
> >>>To: "mozheyko_d_at_mail.ru" <mozheyko_d_at_mail.ru>
> >>>Date: Fri, 26 May 2006 09:04:07 -0400
> >>>Subject: RE: Empty references object
> >>>
> >>>
> >>>
> >>>>Hello Dmitry,
> >>>> Can you send the code that performs the update? Can you provide the source for the Grade class as well? How are the PK's structured?
> >>>
> >>>
> >>>####### Code for update grade of Pupil #############
> >>> ...
> >>> Long gradePK = new Long(<some received value>);
> >>> Grade grade = em.find(Grade.class, gradePK);
> >>> pupil.setGrade(grade);
> >>> em.persist(pupil);
> >>> ...
> >>>
> >>>############ PK of Grade entity is enherited from parent class
> >>>
> >>>...
> >>>@Entity
> >>>@Inheritance(strategy=InheritanceType.JOINED)
> >>>public class MyEntityParent implements java.io.Serializable {
> >>>
> >>> @Id
> >>> @GeneratedValue(strategy = GenerationType.AUTO)
> >>> private Long id;
> >>>...
> >>>
> >>>@Entity
> >>>public class Grade extends VersionControl {
> >>>...
> >>>
> >>>
> >>>
> >>>
> >>>>--Gordon
> >>>>
> >>>>-----Original Message-----
> >>>>From: Dmitry Mozheyko [mailto:mozheyko_d_at_mail.ru]
> >>>>Sent: Friday, May 26, 2006 4:09 AM
> >>>>To: persistence_at_glassfish.dev.java.net
> >>>>Subject: Empty references object
> >>>>
> >>>>
> >>>>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?
> >>>>
> >>
>