vishnuos wrote:
I have a single table consisting of columns
like
Table Name : Person
id: primary not null
name: not null
city: null
phone: null
class PersonInfo{
private long id;
private String name;
}
class Person extends PersonInfo{
private String city;
private String phone;
}
How can I map these two classes in a single mapping file
Well this depends on how you want to map these classes. The simplest approach would be to map Person to the Person table, using the inheritied properties from PersonInfo explicitly.
However, what it seems like you want to do is to use some sub-classing. In this case you would need a discriminator colum in the Person table so that Hibernate can distinguish between persistent instances of PersonInfo and Person.
see: [url]http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-subclass
[/url]