11 Replies Latest reply on Aug 18, 2006 3:09 AM by Kestas ruks

    My collection is not initializing; due to inheritance?

    None None Master

      I have a Person class, which keeps a List of MailingAddress objects. There is a sub-class of Person called Customer which adds a few fields. The MailingAddress itself is a sub-class of an Address object. Person has @OneToMany annotation on its MailingAddress collection, and Address has a @ManyToOne annotation on its Person member.

      When I use a PersistenceManager to load up a Customer from the DB, the list of MailingAddresses is always empty.

      Is this type of use supported? When I create a new Customer, I also create a new MailingAddress. I set the MailingAddress in the Customer and then I persist the Customer, and I can see it is all saved in the db. But when I load the Customer back, it gives me an empty List. I think it's not even a proxy; it's just a plain old Java List.

      I know there are two inheritances happening here: Customer is a subclass of Person, and MailingAddress is a subclass of Address. Should this be working?