Hello!
First of all excuse me for my english, it's not very good.
I have a super class named say
A with the @MappedSuperclass annotation, and i have a class named say
B which extends
A.
In class
A i have defined a field named
profession, which returns a
Person, it's as follows:
Code:
@MappedSuperclass
public class A {
@JoinColumn(name="profession")
@ManyToOne(optional=false)
private Person profession;
public Person getProfession() {
return profession;
}
}
In class
B, which extends
A, i need to overwrite field
profession so it returns a
Doctor instead a
Person, as follows:
Code:
public class B extends A {
@JoinColumn(name="profession")
@ManyToOne(optional=false)
private Doctor profession;
public Doctor getProfession() {
return profession;
}
}
As you can imagine, Doctor extends Person.
So far so good, the problem appears when i run my application, i get a message in my Tomcat logs saying:
Quote:
Caused by: org.hibernate.MappingException: Duplicate property mapping of profession found in org.admon.db.bienes.modelo.DesincorporacionInmuebles
It is like i can not overwrite a field defined in the super class, because it says i have a duplicate property.
Am i doing something wrong?
I hope i was clear, and again, sorry if my english is not that good.
Thanks in advance for your time.
Regards!