-->
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.  [ 2 posts ] 
Author Message
 Post subject: org.hibernate.MappingException: component class not found:
PostPosted: Tue Feb 14, 2006 4:08 pm 
Newbie

Joined: Tue Feb 14, 2006 3:46 pm
Posts: 1
I am trying to generate Schema from mapping files using ANT “hibernatetool” or “schemaexport” task.
It works fine if there is no composite-id but it gave this exception when I tried composite-id in few mapping file.

I tried with Hibernate Console plug-in in JBoss-IDE and it works fine.

What should be the problem ?

Here is my ant task:

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

<target name="schema" depends="init">
<hibernatetool destdir="${basedir}">
<configuration propertyfile="${ejb.dir}${fs}config${fs}hibernate${fs}hibernate.properties" >
<fileset dir="${ejb.dir}${fs}config">
<include name="**/CopayHeaderDTO.hbm.xml"/>
<exclude name="**/z*.hbm.xml"/>
</fileset>
</configuration>
<hbm2ddl
drop="true"
create="true"
export="true"
update="false"
console="true"
outputfilename="${bld.dir}${fs}sql${fs}schema.sql"
delimiter=";"
format="true" >

</hbm2ddl>
</hibernatetool>
</target>






Here are the Exception and config files.




Buildfile: C:\App\projects\drxspace\project\build.xml
onUnix:
init:
schema:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] (cfg.Environment 479 ) Hibernate 3.1 rc3
[hibernatetool] (cfg.Environment 509 ) hibernate.properties not found
[hibernatetool] (cfg.Environment 525 ) using CGLIB reflection optimizer
[hibernatetool] (cfg.Environment 555 ) using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] (cfg.Configuration 264 ) Reading mappings from file: C:\App\projects\drxspace\project\ejbModule\config\hibernate\schema\CopayHeaderDTO.hbm.xml
[hibernatetool] (cfg.HbmBinder 265 ) Mapping class: com.ys.drx.rxhub.formulary.dto.CopayHeaderDTO -> RXHUB_COPAY_HEADER_T
[hibernatetool] (cfg.Configuration 1022) processing extends queue
[hibernatetool] (cfg.Configuration 1026) processing collection mappings
[hibernatetool] (cfg.Configuration 1035) processing association property references
[hibernatetool] (cfg.Configuration 1057) processing foreign key constraints
[hibernatetool] (dialect.Dialect 102 ) Using dialect: org.hibernate.dialect.MySQLDialect
[hibernatetool] (cfg.Configuration 1022) processing extends queue
[hibernatetool] (cfg.Configuration 1026) processing collection mappings
[hibernatetool] (cfg.Configuration 1035) processing association property references
[hibernatetool] (cfg.Configuration 1057) processing foreign key constraints

BUILD FAILED
C:\App\projects\drxspace\project\build.xml:291: org.hibernate.MappingException: component class not found: com.ys.drx.rxhub.formulary.dto.CopayHeaderDTO


Total time: 3 seconds



Hibernate.properties


## MySQL

hibernate.dialect org.hibernate.dialect.MySQLDialect
#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://10.0.0.155/drx
hibernate.connection.username root
hibernate.connection.password admin


CopayHeaderDTO.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->

<class name="com.ys.drx.rxhub.formulary.dto.CopayHeaderDTO" table="RXHUB_COPAY_HEADER_T" >
<composite-id mapped="true">
<key-property name="identificationId" type="java.lang.String" column="IDENTIFICATION_ID" length="10"/>
<key-property name="planName" type="java.lang.String" column="HEALTH_PLAN_X" length="20" />
<key-property name="idType" type="java.lang.String" column="ID_TYPE_X" length="2" />
</composite-id>

<property name="action" type="java.lang.String">
<column name="ACTION_X" length="1" not-null="true"/>
</property>
<property name="effectiveDate" type="java.util.Date">
<column name="EFFECTIVE_DATE_DT" length="8" not-null="true"/>
</property>
</class>
</hibernate-mapping>

_________________
Sanjeev Kumar (SCEA)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 2:33 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you need to put a <classpath> in the <hibernatetool> that contains your domain classes/components.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.