0 Replies Latest reply on Jun 6, 2006 5:18 PM by Chris Hornsey

    Can not use field from subclass as joincolumn

    Chris Hornsey Newbie

      I have a parent class as follows:

      @Table(name = "Parent")
      public class Parent{
      private Set PropertyAsset = new HashSet ();
      private Set FinancialAsset = new HashSet ();

      @OneToMany(cascade=CascadeType.REFRESH, fetch=FetchType.EAGER, mappedBy="parent")
      public Set getPropertyAssets() {return this.PropertyAssets;}
      public void setPropertyAssets(Set PropertyAssets) {this.PropertyAssets = PropertyAssets;}

      @OneToMany(cascade=CascadeType.REFRESH, fetch=FetchType.EAGER, mappedBy="parent")
      public Set getFinancialAsset() {return this.FinancialAsset;}
      public void setFinancialAsset(Set PropertyAssets) {this.FinancialAsset = FinancialAsset;}

      Since both FinancialAsset and PropertyAssets have the parent attribute these classes both extend from a base class named BaseAsset

      @Inheritance(strategy=InheritanceType.JOINED )
      @Table(name = "TBLASSET")
      public abstract class BaseAsset extends{
      private Parent parent = null;

      public Parent getParent() {return parent;}
      public void setParent(Parent parent){this.parent = parent;}

      ....other attributes mapped to table

      The FinancialAsset and PropertyAsset classes have their own table attribute for their class specific attributes.
      They both extend tbl Asset class.

      When Jboss attempts to load the Parent class it raises an error that it can not find the field IREPORTID in tblFinancialAsset.
      I have no idea why it always trys to join from the most specific table rather than the most generic, but it does.

      How would I map this so that I can keep my current class structure?