You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Rusty Wright <ru...@berkeley.edu> on 2007/05/16 19:01:22 UTC

anyone using xmlbeans with enumerations with ibatis?

Xmlbeans is a package that generates java code for you from your xml schema.

I'm a bit of a java newbie and am trying to do a simple shopping cart 
application.  In my xml schema for products I specified a product type 
(not category) that can have two values, tangible and download, using 
enumeration.  In the generated xmlbeans code it has an interface with an 
inner final static class with the name Enum.  I hadn't looked at that 
code and blazed ahead and wrote a type handler for it calling its 
toString() to get its value for ibatis.  But it blows up when ibatis 
tries to instantiate an Enum, which makes sense since it's final.

My workaround was to write a ProductWrapper which takes a Product arg 
for its constructor and it has getters for the various Product fields, 
and to use the ProductWrapper with ibatis.

I was wondering if there's a better way.

Thanks

-- 
Rusty Wright
UC Berkeley
IS&T Web Applications
510-643-9097  office
925-212-3774  cell