-->
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: problem with custom type generation
PostPosted: Thu Jun 14, 2007 6:17 am 
Newbie

Joined: Thu Jun 14, 2007 5:38 am
Posts: 6
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 14, 2007 8:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Your custom type is probably not on the classpath preventing hbm2java to ask it what return class it actually maps.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 14, 2007 10:21 am 
Newbie

Joined: Thu Jun 14, 2007 5:38 am
Posts: 6
I have seen sometimes this classpath problem but I mean in this case the hbm2java was not able to find the private types... in my case they are found because the mapping was processed only in wrong way...

What does it exactly this classpath issue mean?
I have the following file structure:

D:.
| .classpath
| .myhibernatedata
| .mymetadata
| .project
| BCUSER.mer
| build.xml
| semops-ddl.sql
|
|
+---lib
| antlr-2.7.5H3.jar
| asm-attrs.jar
| asm.jar
| c3p0-0.9.0.jar
| cglib-2.1.3.jar
| commons-collections-2.1.1.jar
| commons-logging-1.0.4.jar
| dom4j-1.6.1.jar
| freemarker.jar
| hibernate-tools.jar
| hibernate3.jar
| hsqldb.jar
| jta.jar
| jtidy-r8-21122004.jar
| log4j.properties
| ojdbc14.jar
|
+---src
| | log4j.properties
| | | +---com
| | \---fornax
| | \---semops
| | \---bank
| | \---db
| | +---entities
| | | AAUserTypes.hbm.xml
| | | Accesspoint.hbm.xml
| | | Accesspoint.java
| | | AccesspointDAO.java
| | | Account.hbm.xml
| | | Account.java
| | | AccountDAO.java
| | | Bank.hbm.xml
| | | Bank.java
| | | BankDAO.java
| | | Client.hbm.xml
| | | Client.java
| | | ClientDAO.java
| | | Customeraccount.java
| | | CustomeraccountDAO.java
| | | DirectSettlementLog.java
| | | IndirectSettlementLog.java
| | | Limititem.hbm.xml
| | | Limititem.java
| | | LimititemDAO.java
| | | Limitpackage.hbm.xml
| | | Limitpackage.java
| | | LimitpackageDAO.java
| | | Limitstatus.hbm.xml
| | | Limitstatus.java
| | | LimitstatusDAO.java
| | | LimitstatusId.java
| | | Lostitem.hbm.xml
| | | Lostitem.java
| | | LostitemDAO.java
| | | Merchantconnection.hbm.xml
| | | Merchantconnection.java
| | | MerchantconnectionDAO.java
| | | MerchantCreditLog.java
| | | MerchantTransferLog.java
| | | Module.hbm.xml
| | | Module.java
| | | ModuleDAO.java
| | | Moduleversion.hbm.xml
| | | Moduleversion.java
| | | ModuleversionDAO.java
| | | MoneyDistributionLog.java
| | | MoneyTransferNoticeLog.java
| | | MyLimititemDAO.java
| | | MyMerchantconnectionDAO.java
| | | MyModuleDAO.java
| | | MySemopstransactionDAO.java
| | | MyTransactioneventDAO.java
| | | OffUsPaymentLog.java
| | | OffUsReservationLog.java
| | | OnUsPaymentLog.java
| | | OnUsReservationLog.java
| | | Parameter.hbm.xml
| | | Parameter.java
| | | ParameterDAO.java
| | | PaymentLog.java
| | | Privilege.hbm.xml
| | | Privilege.java
| | | PrivilegeDAO.java
| | | ReservationLog.java
| | | Role.hbm.xml
| | | Role.java
| | | RoleDAO.java
| | | Semopstransaction.hbm.xml
| | | Semopstransaction.java
| | | SemopstransactionDAO.java
| | | Technicalaccount.java
| | | TechnicalaccountDAO.java
| | | TechnicalAccountType.java
| | | Transactionevent.hbm.xml
| | | Transactionevent.java
| | | TransactioneventDAO.java
| | | Transactionid.hbm.xml
| | | Transactionid.java
| | | TransactionidDAO.java
| | | Transferlog.hbm.xml
| | | Transferlog.java
| | | TransferlogDAO.java
| | | Unexpectedincome.hbm.xml
| | | Unexpectedincome.java
| | | UnexpectedincomeDAO.java
| | | Userprofile.hbm.xml
| | | Userprofile.java
| | | UserprofileDAO.java
| | |
| | +---exception
| | | InfrastructureException.java
| | |
| | \---persistence
| | BankRoleType.java
| | ChannelType.java
| | ClientModuleType.java
| | ClientStatusType.java
| | CurrencyST.java
| | InternationalAccNoFormatType.java
| | LegacyStatusType.java
| | MerchantConnectionType.java
| | ReconciliationStatus.java
| | StringEnumUserType.java
| | TechnicalAccountType.java
| | TransactionStatus.java
| | TransactionType.java
| | UserTypes.hbm.xml
| |
| +---hibernate
| | \---config
| | hibernate.cfg.xml
| | hibernate.reveng2.xml
| |
| \---META-INF
| hibernate-service.xml
| MANIFEST.MF
|


and this is my build script:

<project name="SemopsDB.har" basedir=".">

<!-- Name of project and version, used to create filenames. -->
<property name="name.project" value="SemopsDB.har"/>
<property name="name.short" value="SemopsDB.har"/>
<property name="version" value="0.9"/>

<!-- Global properties for this build. -->
<property name="src.java.dir" value="src"/>
<property name="config.dir" value="${src.java.dir}/hibernate/config"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/standalone"/>
<property name="test.out.dir" value="testout"/>
<property name="test.driver" value="${lib.dir}/ojdbc14.jar"/>

<!-- Classpath declaration -->
<path id="project.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>

<patternset id="meta.files">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</patternset>

<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="project.classpath"/>

<!-- Targets -->


<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"/>

<!-- <configuration >
<fileset dir="${src.java.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration> -->

<hbm2java jdk5="true"/> <!-- Generate entity class source -->
<!-- <hbm2dao/> -->
</hibernatetool>
</target>


Should I set something additonaly?


Thanks your help!
topicfun


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.