We need to extend/subclass a Entity/MappedSuperclass from a library with our web framework's validation annotations. I'm near certain your framework makes this impossible, but I thought I'd ask. Here's what we wish to do:
Code:
@Entity
@Table(name="Person")
public class WebPerson extends Person {
@Override
@Validate("require")
public String getName() { return super.getName(); }
}
Pretty basic: override an existing column, with the new override having an additional annotation on it.
I'm pretty sure this behavior— overriding a column— is not possible. Here's the stack that's thrown:
Code:
org.hibernate.MappingException: Duplicate property mapping of queryName found in us.catalist.ngqt.entities.NgqtQuery
at org.hibernate.mapping.PersistentClass.checkPropertyDuplication(PersistentClass.java:477)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:467)
at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1135)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
Anyone know any neat tricks to try? I've tried extending an existing Entity and a MappedSuperclass, same MappingException for both. :(
-rektide