-->
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: hbm2ddl alpha4 problem with 2.1.8 component migration to 3.0
PostPosted: Thu Aug 11, 2005 3:53 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0.5

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="com.whitezone.domain.User"
table="USER"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
lazy="true"
batch-size="6"
>

<id
name="id"
column="USER_ID"
type="java.lang.Long"
>
<generator class="native">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-User.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<set
name="profiles"
table="USER_PROFILE"
outer-join="auto"
lazy="true"
batch-size="6"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="USER_ID"
>
</key>

<many-to-many
class="com.siemens.swa.domain.Profile"
column="PROFILE_ID"
outer-join="auto"
/>

</set>

<property
name="login"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="LOGIN"
length="20"
not-null="true"
unique="true"
/>

<property
name="name"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="NAME"
length="80"
not-null="true"
/>

<property
name="password"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="PASSWORD"
length="20"
not-null="true"
/>

<property
name="birthday"
type="date"
update="true"
insert="true"
access="property"
column="BIRTHDAY"
/>

<property
name="fatherName"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="FATHER_NAME"
/>

<property
name="motherName"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="MOTHER_NAME"
/>

<property
name="cpf"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="CPF"
length="14"
unique="true"
/>

<property
name="complement"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="COMPLEMENT"
/>

<property
name="rg"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="RG"
length="18"
unique="true"
/>

<property
name="category"
type="java.lang.String"
length="5"
update="true"
insert="true"
access="property"
column="CATEGORY"
/>

<property
name="driverLicense"
type="java.lang.String"
length="30"
update="true"
insert="true"
access="property"
column="DRIVER_LICENSE"
/>

<property
name="pis"
type="java.lang.String"
length="30"
update="true"
insert="true"
access="property"
column="PIS"
/>

<property
name="professionalNumber"
type="java.lang.String"
length="30"
update="true"
insert="true"
access="property"
column="PROF_NUMBER"
/>

<property
name="series"
type="java.lang.String"
length="7"
update="true"
insert="true"
access="property"
column="SERIES"
/>

<component name="address">
<property name="street"/>
<property name="quarter"/>
<property name="number" type="java.lang.String"/>
<property name="complementAddress"/>
<property name="cep"/>
<property name="city"/>
<property name="state"/>
<property name="country"/>
</component>

<component name="contact">
<property name="email"/>
<property name="phone1"/>
<property name="phone2"/>
<property name="phone3"/>
</component>

<component name="userCompanyInfo">
<property name="position"/>
<property name="register1" unique="true"/>
<property name="register2"/>
<property name="register3"/>
<property name="register4"/>
<property name="comment"/>
<property name="workLoad"/>
<property name="cdc"/>
<property name="sector"/>
<property name="subarea"/>
<property name="project"/>
<property name="branch1"/>
<property name="branch2"/>
</component>

<component name="contract">
<property name="company"/>
<property name="status"/>
<property name="typeContract"/>
<property name="reason"/>
<property name="dateExpiration"/>
<property name="dateAdmission"/>
<property name="dateResignation"/>
</component>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-User.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
/home/iksrazal/ewatch1/watchdog/build.xml:279: Failed in building configuration when adding /home/iksrazal/ewatch1/watchdog/src/com/whitezone/domain/User.hbm.xml
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:112)
at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:91)
at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:77)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:50)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:150)
at org.hibernate.tool.ant.Hbm2DDLGeneratorTask.execute(Hbm2DDLGeneratorTask.java:38)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: org.hibernate.MappingException: Could not configure datastore from file: /home/iksrazal/ewatch1/watchdog/src/com/whitezone/domain/User.hbm.xml
at org.hibernate.cfg.Configuration.addFile(Configuration.java:249)
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:108)
... 16 more
Caused by: org.hibernate.MappingException: class com.whitezone.domain.User not found while looking for property: address
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
at org.hibernate.cfg.HbmBinder.reflectedPropertyClass(HbmBinder.java:1462)
at org.hibernate.cfg.HbmBinder.bindComponent(HbmBinder.java:1531)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1777)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1728)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:318)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
at org.hibernate.cfg.Configuration.add(Configuration.java:362)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
... 17 more
Caused by: java.lang.ClassNotFoundException: com.whitezone.domain.User
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
... 27 more
--- Nested Exception ---
org.hibernate.MappingException: Could not configure datastore from file: /home/iksrazal/ewatch1/watchdog/src/com/whitezone/domain/User.hbm.xml
at org.hibernate.cfg.Configuration.addFile(Configuration.java:249)
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:108)
at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:91)
at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:77)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:50)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:150)
at org.hibernate.tool.ant.Hbm2DDLGeneratorTask.execute(Hbm2DDLGeneratorTask.java:38)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: org.hibernate.MappingException: class com.whitezone.domain.User not found while looking for property: address
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
at org.hibernate.cfg.HbmBinder.reflectedPropertyClass(HbmBinder.java:1462)
at org.hibernate.cfg.HbmBinder.bindComponent(HbmBinder.java:1531)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1777)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1728)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:318)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
at org.hibernate.cfg.Configuration.add(Configuration.java:362)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
... 17 more
Caused by: java.lang.ClassNotFoundException: com.whitezone.domain.User
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
... 27 more

Name and version of the database you are using:
MySQL 4.1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hi All,

I managed to write a simple class from scratch that works fine with hbm2ddl alpha4 and Hibernate 3 . I'm now trying to migrate our 2.1.8 app to 3.0.5 . I changed the dtd, and got the stackTrace above. My ant task:

Code:
<!-- Formally introduce Ant to the toolset -->
  <taskdef name="hibernatetool"
    classname="org.hibernate.tool.ant.HibernateToolTask">
    <classpath refid="classpath-jboss"/>
  </taskdef>


  <!-- Generate the java code for all mapping files in our source tree -->
  <target name="ddl"
           description="Generate Java source from the O/R mapping files">
    <mkdir dir="${build}/schema"/>
    <hibernatetool destdir="${build}/schema/create-tables.sql">
      <configuration configurationfile="hibernate-cfg.xml">
        <fileset dir="src">
          <include name="**/*.hbm.xml"/>
        </fileset>
      </configuration>
      <hbm2ddl export="false" outputfilename="try.sql" />
    </hibernatetool>
  </target>


My hibernate-cfg.xml only has:

Code:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory name="java:/hibernate/HibernateFactory">
  <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
</session-factory>
</hibernate-configuration>


Any ideas?
iksrazal


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 1:14 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Just to follow up, the component classes need to be compiled and in the classpath.

iksrazal


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.