Hibernate more picky on character type discriminators

November 20, 2008 – 22:15 | java | Tags: ,

On a project I’m working on, I’ve got one abstract base class and two subclasses, which are mapped to one same table, with a single character column as the discriminator. I got this error when Hibernate initializes:

org.hibernate.MappingException: multiple or zero characters found parsing string

Turns out if the discriminator type is “character”, the base class must have a discriminator-value attribute declared, even though obviously due to the abstractness there will never be any row carrying that discriminator value. And apparently for “string” type discriminators, there isn’t such a limitation.

Trackback from your site, or follow the comments in RSS.

Post a Comment