@MappedSuperclass
public abstract class BaseBean{
@Id
@GeneratedValue
Long id;
String name;
}
@Entity
public class A extends BaseBean{
}
@Entity
public class B extends BaseBean{
}
Is it possible to set the name attribute as transient just for the class B
No, it doesn't work. The @MappedSuperclass
fields/properties are always considered and even when you use property-access and try to override the properties with different annotation, Hibernate will still use the one from the base class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With