Thread:
 Bound mismatch in Enhanced UserType tip 
 dipp0   19 Apr 2005, 08:37 
 Re: Bound mismatch in Enhanced UserType tip 
 stephan.maier   24 Apr 2005, 08:42 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: stephan.maier (24 Apr 2005, 08:42) Replies: 0, Views: 37217
Subject: Re: Bound mismatch in Enhanced UserType tip
Here's a solution to the problem (I just cpy the relevant lines):

private Class<? extends Enum> enumClass;

public void setParameterValues(Properties parameters) {
   String enumClassName = parameters.getPropert("enumClassName");
   try {
      enumClass = Class.forName(enumClassName).asSubclass(Enum.class);
   }
   catch (ClassNotFoundException cnfe) {
      throw new HibernateException("Enum class not found", cnfe);
   }
}

Observe the way I declared the attribute enumClass. also check the way 
I did the cast by using the method #asSubclass ont the Class-class. 
That should do the trick - it does it for me.

Stephan
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]