Hi all, I have a class Executive which inherits of the Person class. See below:
/**
*
* Mapping for Person table.
*
* @version $Id: Person.java,v 1.5 2004/03/01 22:43:18 aryjr Exp $
* @author <a href="mailto:
[email protected]">Ary Junior</a>
*
* @hibernate.class
* table="Person"
*
*/
public class Person {
...
public void setCompany(Company company) {
this.company = company;
}
/**
*
* @hibernate.many-to-one
* column="CompanyId"
*
* @return br.com.valoriza.imf.site.persistence.Company
*/
public Company getCompany() {
return company;
}
...
}
/**
*
* Mapping for Executive table.
*
* @version $Id: Executive.java,v 1.4 2004/02/26 15:32:07 aryjr Exp $
* @author <a href="mailto:
[email protected]">Ary Junior</a>
*
* @hibernate.joined-subclass
* table="Executive"
*
* @hibernate.joined-subclass-key
* column="PersonId"
*/
public class Executive extends Person {
...
}
I have too the Company class which have a collection of executives, see below:
public void setExecutives(Set executives) {
this.executives = executives;
}
/**
*
* @hibernate.set
* role="executives"
* table="Executive"
* order-by="Name ASC"
* cascade="all"
* readonly="true"
* inverse="true"
*
* @hibernate.collection-key
* column="CompanyId"
*
* @hibernate.collection-one-to-many
* class="br.com.valoriza.imf.site.persistence.Executive"
*
* @return java.util.Set
*/
public Set getExecutives() {
return executives;
}
Since the CompanyId column belongs to the table Person and not it Executive table, the Hibernate return the message below:
...
Caused by: java.sql.SQLException: Column not found, message from server: "Unknown column 'executives0_.CompanyId' in 'field list'"
...
Some suggestion? This is a limitation?
[]'s
Ary Junior