-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: org.hibernate.MappingException: Illegal discriminator type:
PostPosted: Tue May 11, 2010 10:12 pm 
Newbie

Joined: Tue May 11, 2010 9:34 pm
Posts: 2
Hello,

I have a table with a number of fixed CHAR fields for which I need to use a UserType (TrimmedStringUserType). This works fine, however one of these fields is the discriminator for my subclasses so I tried using this UserType in the discriminator like this:
<class name="RoutingRule" table="BR_ROUTING_RULE" abstract="true">
<id name="id" column="RULE_ID">
<generator class="identity" />
</id>
<discriminator column="RULE_TYPE_CD" type="changed.package.TrimmedStringUserType"/>
<property name="name" column="NAME" />

<subclass name="LogicRoutingRule" discriminator-value="REQ_CRIT">
<property name="logic" column="LOGIC" />
</subclass>
</class>

and I receive this exception:
Caused by: org.hibernate.MappingException: Illegal discriminator type: changed.package.TrimmedStringUserType
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:304)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 110 more

So UserTypes are not allowed within discriminators, it seems. How can I trim these legacy columns for comparison with the discriminator values?
Thanks for any information or insight.


Top
 Profile  
 
 Post subject: Re: org.hibernate.MappingException: Illegal discriminator type:
PostPosted: Wed May 12, 2010 3:34 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
You should ask this question on the Hibernate User forum. I think though that for a user type to be used as discriminator it has to implement EnhancedUserType.

--Hardy


Top
 Profile  
 
 Post subject: Re: org.hibernate.MappingException: Illegal discriminator type:
PostPosted: Wed May 12, 2010 9:12 am 
Newbie

Joined: Tue May 11, 2010 9:34 pm
Posts: 2
Thank you for your suggestion and direction to the correct forum.
I will implement the correct interface.
Cheers.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.