Hibernate version:2.1
I have a class called PropertyRight which has a property called "modifyValidator". This property is supposed to store a serialized Java object of type Validator. Validator is an interface, and I have a huge number of classes which implement Validator. Hibernate accepts my mapping file in which I have specified the property as
<property name="modifyValidator" type="serializable">
<column name="MODIFY_VALIDATOR"/>
</property>
I can create an instance of PropertyRight, set its validator to be an instance of StringNotEmptyOrNullValidator (a type of Validator) and store it in the datbase, however, when I load the PropertyRight back in I get the exception below stating that it is an error to store a subtype of Validator in a column ment to store instances of Validator. This surprises me, because naturally I would expect Hibernate to support polymorphic serialization.
Has anyone got a clue to why this happens?
Randahl
15:13:45,765 ERROR [BasicPropertyAccessor] IllegalArgumentException in class: dk.rockit.puls.server.entity.security.right.PropertyRight, setter method of property: modifyValidator
15:13:45,765 ERROR [BasicPropertyAccessor] expected type: dk.rockit.puls.omnipresent.validator.Validator, actual value: dk.rockit.puls.omnipresent.validator.string.StringNotEmptyOrNullValidator
[Note to the reader:] StringNotEmptyOrNullValidator is a class which implements the interface Validator
|