I am a newbie and am trying to get these entities to talk. 

I can write to the data to the db (I check with the db manager and the store is 
in the db) but when I retrieve the data I get the customer details including 
the address but the StoreList is empty.

Any ideas ?

Thanks

@Entity
  | @Table(name = "CUSTOMER")
  | public class CustomerCMP implements java.io.Serializable{
  | 
  |     private Long id;
  |     private String name;
  |     private String contact;
  |     private AddressCMP address;
  |     private List<StoreCMP> StoreList;
  | 
  |     public CustomerCMP(){} 
  | 
  |     public CustomerCMP(String Name, String Contact) 
  |     {
  | //          Debug.print("Create", this);
  |             this.name = Name;
  |             this.contact = Contact;
  |     }
  | 
  |     @Id(generate = GeneratorType.AUTO)
  |     @Column(name = "customerId", nullable = false)
  |     public Long getId() {
  |             return id;
  |     }
  |     public void setId(Long id) {
  |             this.id = id;
  |     }
  |     
  |     @Column(name="NAME")
  |     public String getName() {
  |             return name;
  |     }
  |     public void setName(String name) {
  |             this.name = name;
  |     }
  | 
  |     @Column(name="CONTACT")
  |     public String getContact() {
  |             return contact;
  |     }
  |     public void setContact(String contact) {
  |             this.contact = contact;
  |     }
  | 
  |     @OneToOne(cascade = {CascadeType.ALL})
  |     @JoinColumn(name = "addressId")
  |     public AddressCMP getAddress() {
  |             return address;
  |     }
  |     public void setAddress(AddressCMP address) {
  |             this.address = address;
  |     }
  | 
  |     @OneToMany(targetEntity=com.meerkat.jfr.par.StoreCMP.class, 
  |                     cascade={CascadeType.ALL}, 
  |                     fetch=FetchType.EAGER, 
  |                     mappedBy="customer")    
  |     public List<StoreCMP> getStoreList()
  |     {
  |             return StoreList;
  |     }
  |     public void setStoreList(List<StoreCMP> StoreList)
  |     {
  |             this.StoreList = StoreList;
  |     }
  | 
  |     public StoreCMP addToStoreList(StoreCMP store)
  |     {
  |             if (this.StoreList == null)
  |             {
  |                     this.StoreList = new ArrayList<StoreCMP>();
  |             }
  |             store.setCustomer(this);
  |             getStoreList().add(store);
  |             return store;
  |     }
  |     public StoreCMP removeFromStoreList(StoreCMP store)
  |     {
  |             getStoreList().remove(store);
  |             store.setCustomer(null);
  |             return store;
  |     }
  | }
  | 
  | @Entity
  | @Table(name = "STORE")
  | public class StoreCMP implements Serializable 
  | {
  |     private Long id;
  |     private String name;
  |     private AddressCMP address;
  |     private String code;
  |     private CustomerCMP customer;
  |     
  |     public StoreCMP()
  |     {
  |     }
  |     public StoreCMP(Long id, String Name, AddressCMP address, String code ) 
  |     {
  |             setId(id);
  |             setName(name);
  |             setAddress(address);
  |             setCode(code);
  |     }
  | 
  |     @Id(generate = GeneratorType.AUTO)
  |     @Column(name="StoreId", nullable=false)
  |     public Long getId() {
  |             return id;
  |     }
  |     public void setId(Long id) {
  |             this.id = id;
  |     }
  | 
  |     @OneToOne(cascade = {CascadeType.ALL}, fetch=EAGER)
  |     @JoinColumn(name = "ADDRESSID")
  |     public AddressCMP getAddress() {
  |             return address;
  |     }
  |     public void setAddress(AddressCMP address) {
  |             this.address = address;
  |     }
  |     @Column(name="CODE")
  |     public String getCode() {
  |             return code;
  |     }
  |     public void setCode(String code) {
  |             this.code = code;
  |     }
  |     @Column(name="NAME")
  |     public String getName() {
  |             return name;
  |     }
  |     public void setName(String name) {
  |             this.name = name;
  |     }
  | @ManyToOne
  | @JoinColumn(name="customerId")
  | //@JoinColumn(name="customerId", nullable=false)
  | public CustomerCMP getCustomer()
  | {
  |     return customer;
  | }
  | public void setCustomer(CustomerCMP customer)
  | {
  |     this.customer = customer;
  | }
  | }
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3895244#3895244

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3895244


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to