Hi!
I have created an enum custom type and mapped some my enum class to it.
I have followed the steps that was introduced in the caveatemptor example:
One of my hbm xml:
<hibernate-mapping> <class name="com.fornax.semops.bank.db.entities.Account" table="ACCOUNT" schema="BCUSER"> <id name="idAccount" type="long"> <column name="ID_ACCOUNT" precision="22" scale="0" /> <generator class="native" /> </id> <version name="version" type="long"> <column name="VERSION" precision="22" scale="0" /> </version> <property name="accountno" type="string"> <column name="ACCOUNTNO" /> </property> <property name="active" type="long"> <column name="ACTIVE" precision="1" scale="0" /> </property> [color=red] <property name="internationalaccnoformat" type="InternationalAccNoFormatType"> <column name="INTERNATIONALACCNOFORMAT" /> </property>
one piece from the the UserTypes.xml
<typedef class="com.fornax.semops.bank.db.persistence.StringEnumUserType" name="InternationalAccNoFormatType"> <param name="enumClassname">com.fornax.semops.bank.db.persistence.InternationalAccNoFormatType</param> </typedef>
and that is my ant script:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.classpath"/>
<target name="reveng.pojos" description="Produces Java classes from XML mappings"> <hibernatetool destdir="${src.java.dir}"> <classpath path="${src.java.dir};$(project.classpath)"/> <configuration configurationfile="${config.dir}/hibernate.cfg.xml"/> <hbm2java jdk5="true"/> <!-- Generate entity class source --> <!-- <hbm2dao/> --> </hibernatetool> </target>
My problem that after running the ant script, I get the following in the pojo:
private String accountno;
private long active;
private StringEnumUserType internationalaccnoformat;
Why the StringEnumUserType appears in the POJO? This is totally strange for me because I have looked up some examples and I wait for something like as:
private InternationalAccNoFormatType internationalaccnoformat;
If I change the class with enumclass in the usertype.xml (I mean this is a stupid way) the generation is OK but in this case the deploy is not OK.
<typedef class="com.fornax.semops.bank.db.persistence.BankRoleType" name="BankRoleType"> <param name="enumClassname">com.fornax.semops.bank.db.persistence.StringEnumUserType</param> </typedef>
I can't imagine where I have made any mistake...???
Please help me!
Thanks,
topicfun
|