-->
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: Component Class not found with Composite ID
PostPosted: Sat Nov 25, 2006 6:27 am 
Newbie

Joined: Thu Aug 03, 2006 5:50 am
Posts: 15
Hi Guys

Have to following problem
when I try to build the Export Schema for the database in NetBeans with XDoclet I get the following exception
D:\java\build.xml:27: Schema text failed: component class not found: com.data.HibernateID

My Classes look like this:

Code:


package com.data;


/**
*
*
* @hibernate.class
*     table="NEW_HIBERNATE_BEAN"
*
*/
public class NewHibernateBean{

   private NewHibernateBeanID id;
/**
  *   @hibernate.id
  *      unsaved-value="any"
  */
   public NewHibernateBeanID getId () {
      return id;
   }
   public void setId (NewHibernateBeanID id) {
      this.id = id;
   }

}


and

Code:
package com.data;

import java.io.Serializable;
/**
*
*
* @hibernate.component
*   
*
*/


public class NewHibernateBeanID implements Serializable{
   
   
   private String test;
   /**
    *   @hibernate.property
    */
   public String getTest() {
       return test;
   }
   public void setTest(String test) {
       this.test = test;
   }

   
    public int hashCode() {
        return 0
    }

    public boolean equals(Object obj) {
        return true;
    }

   
}



The follwing .hbm.xml file is generated

Code:
<?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
>
    <class
        name="com.data.NewHibernateBean"
        table="NEW_HIBERNATE_BEAN"
    >

        <composite-id
            name="id"
            class="com.data.NewHibernateBeanID"
            unsaved-value="any"
        >
                     <key-property
                        name="test"
                        type="java.lang.String"
                        column="test"
                />

        </composite-id>



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

    </class>

</hibernate-mapping>




I really dont know why this does not work.

Hope you can help me!

Thank you in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 25, 2006 12:22 pm 
Newbie

Joined: Thu Aug 03, 2006 5:50 am
Posts: 15
YIPPIE, Hurray!!!

I finally solved the problem!!

Thought it might be interesting for you:

I had to add the class-path in the extensionsProperties file for ant!!

Here you can see it:

Code:
<target name="hibernate-schema-export" depends="init,project-extension-init">
    <taskdef name="schemaexport" classname="org.hibernate.tool.hbm2ddl.SchemaExportTask" classpath="[b]${hibernate.classpath}[/b]"  />
    <schemaexport properties="extension/hibernate.properties" quiet="no" text="no" drop="no" delimiter=";" output="${basedir}/${build.dir}/schema-export.sql">
      <fileset dir="${build.classes.dir}">
        <include name="**/*.hbm.xml" />
      </fileset>
    </schemaexport>


this variable is set in the extenstionsProperties:



Code:
hibernate.classpath = ${libs.hib-cglib-full.jar.classpath}:\
${libs.hib-commons-collections.jar.classpath}:\
${libs.hib-commons-logging.jar.classpath}:\
${libs.hib-concurrent.jar.classpath}:\
${libs.hib-dom4j-1.jar.classpath}:\
${libs.hib-ehcache.jar.classpath}:\
${libs.hib-hibernate.jar.classpath}:\
${libs.hib-jdbc-driver.jar.classpath}:\
${libs.hib-jdbc2_0-stdext.jar.classpath}:\
${libs.hib-jta.jar.classpath}:\
[b]${build.classes.dir}[/b]


Wow, I am so glad that it finally works!!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 25, 2006 4:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
huh ? there is no hibernate.classpath read anywhere so this sounds very crazy.

the classpath should be in the hibernatetool task.

_________________
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.  [ 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.