Hi, I have an entity class, class B,  that extends from a base entity class.
The base entity class has two fields.
There is a parent class,  class A, which has a one-to-many relation with class B.
My problem is that when i try to retrieve class B from class A, the fields in the base entity class is not reflecting in the HQL.
The code for the base entity is as given below:
Code:
public abstract class BaseEntity {
private String name;
private String value;
protected BaseEntity() {}
@Column(name = "NAME")
   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
   @Column(name = "VALUE")
   public String getValue() {
      return value;
   }
   public void setValue(String value) {
      this.value= value;
   }
   public NameVO retrieveNameVO() {
      NameVO nameVO = new NameVO();
      String name = this.getName();
      if (null != name && name.length() > 0) {
         nameVO.setName(name);
         nameVO.setValue(this.getValue());
      }
      return nameVO;
   }
}
The class which extends base entity is:
Code:
@Entity
@Table(name = "MST_B")
public class B extends BaseEntity {
   
   protected B () {
super();
   }
   
   private BPK bPK;
   @EmbeddedId
   @AttributeOverrides({
         @AttributeOverride(name = "code", column = @Column(name = "CODE")),
         @AttributeOverride(name = "number", column = @Column(name = "NUMBER")),
         @AttributeOverride(name = "id", column = @Column(name = "NAME_ID"))})
   public BPK getBPK() {
      return bPK;
   }
   public void setBPK(BPK bPK) {
      this.bPK = bPK;
   }
}
And finally the parent class
Code:
@Entity
@Table(name = "MST_A")
public class A {
   private String route;
   private Set<B> bSet;
   /*
    * default constructor for JPA
    */
   protected A() {
   }
   public A(AVO aVO) {
   }
   public AVO retrieveAVO() {
      AVO vo = new AVO();
      vo.setRoute(this.getRoute());
      vo.setNameVOs(retrieveNameVOs());
      return vo;
   }
   
   private List<NameVO> retrieveNameVOs() {
      List<NameVO> nameVOs = new LinkedList<NameVO>();
      for (B b : bSet) {
         NameVO nameVO = b.retrieveNameVO();
         nameVOs.add(nameVO);
      }
      return nameVOs;
   }
   @Column(name = "ROUTE")
   public String getRoute() {
      return route;
   }
   public void setRoute(String route) {
      this.route = route;
   }
   
   @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
   @JoinColumns({
         @JoinColumn(name = "CODE", referencedColumnName = "CODE", insertable = false, updatable = false),
         @JoinColumn(name = "NUMBER", referencedColumnName = "NUMBER", insertable = false, updatable = false) })
   public Set<B> getbSet() {
      return bSet;
   }
   public void setbSet(Set<B> bSet) {
      this.bSet = bSet;
   }
}
And the HQL query is
Quote:
StringBuilder sqlQuery = new StringBuilder()
				.append("select distinct parentClass from A parentClass")
				.append(" left join fetch parentClass.bSet child");
The sql generated takes the child class into consideration, but the column NAME and VALUE doesnt get reflected in the query.
Please help me.