Please see where I got it wrong. The error is:
Could not determine type for: Person, for columns: [org.hibernate.mapping.Column(TEACHER_ID)]
Hibernate version: 3.1.3
Mapping documents:
Code:
<class name="Book" schema="AAAA" table="BOOK">
<id name="id" column="ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">s_global_id</param>
</generator>
</id>
<property name="title" type="java.lang.String" column="TITLE" />
</class>
<class name="Person" schema="AAAA" table="PERSON">
<id name="id" column="ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">s_global_id</param>
</generator>
</id>
<joined-subclass name="Teacher" schema="AAAA" table="TEACHER">
<key column="ID"/>
<list name="books" table="TEACHER_BOOK" fetch="select" cascade="all">
<key column="TEACHER_ID" />
<list-index column="INDX" base="0"/>
<many-to-many column="BOOK_ID" class="Book" fetch="select" />
</list>
</joined-subclass>
</class>
Full stack trace of any exception that occurs:Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: Person, for columns: [org.hibernate.mapping.Column(TEACHER_ID)]
Caused by: org.hibernate.MappingException: Could not determine type for:Person, for columns: [org.hibernate.mapping.Column(TEACHER_ID)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
Name and version of the database you are using:MySql Ver 14.12 Distrib 5.0.45
Code:
class Book {
Long id;
String title;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
class Person {
Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
class Teacher extends Person {
List<Book> books;
public List<Book> getBooks() {
return books;
}
public void setBooks(List<Book> books) {
this.books = books;
}
}