-->
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.  [ 6 posts ] 
Author Message
 Post subject: class not found in schema export with a composite identifier
PostPosted: Mon Jul 31, 2006 4:16 am 
Newbie

Joined: Fri Jul 28, 2006 10:38 am
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

I'm using Hibernate inside NetBeans 5.0 with a JDK 1.4.2.05. Everything is working fine, but when I try to map a table with a composite key and generate the database schema I get a "component class not found error". If I generate the same class with a single field primary key it works just fine and I get no class not found exceptions.

Hibernate version: Hibernate 3.0

Mapping documents:
Code:
<hibernate-mapping package="it.gpa.passcompagnia.domain">
    <class name="RGIVersione" table="pcversio" lazy="false">
        <composite-id>
            <key-property name="idpolizza" column="idpolizza" type="string" length="12" />
            <key-property name="nverinizio" column="nverinizio" type="string" length="12" />
        </composite-id>
        <!-- a bunch of other properties -->
    </class>
</hibernate-mapping>


Full stack trace of any exception that occurs:
09:51:15,259 INFO Configuration:893 - processing foreign key constraints
C:\localrep\myProject\06Deployment\build-hibernate.xml:50: Schema text failed: component class not found: my.package.RGIVersione

Name and version of the database you are using: Microsoft SQL Server 2000

Debug level Hibernate log excerpt:
Code:
10:01:21,747  INFO HbmBinder:258 - Mapping class: it.gpa.passcompagnia.domain.RGIMovimento -> pcmovime
10:01:21,747  INFO Configuration:440 - Mapping resource: it/gpa/passcompagnia/service/persistenza/domain/RGIVersione.hbm.xml
10:01:21,762  INFO HbmBinder:258 - Mapping class: it.gpa.passcompagnia.domain.RGIVersione -> pcversio
10:01:21,794  WARN HbmBinder:421 - Could not perform validation checks for component as the class it.gpa.passcompagnia.domain.RGIVersione was not found


If I use a class as an identifier, e.g.
Code:
<composite-id name="idrgiversione" class="IDRGIVersione">
            <key-property name="idpolizza" column="idpolizza" type="string" length="12" />
            <key-property name="nverinizio" column="nverinizio" type="string" length="12" />
        </composite-id>

I get the same error, only referencing the class of the identifier.
I have read two books, the online documentation, looked for a solutions in a ton of posts: everything looks fine but it doesn't work. Where am I wrong?

t.i.a.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 7:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you need to put the classes into the classpath when telling hibernate to do its schemaexport.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 7:26 am 
Newbie

Joined: Fri Jul 28, 2006 10:38 am
Posts: 4
FOA thank you for the quick answer.
The classes already are in the classpath; in fact if I don't use a composite identifier the tool wonderfully generates a perfect schema.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 7:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if they were in the classpath hbm2ddl would not complain.

check the spelling.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 8:04 am 
Newbie

Joined: Fri Jul 28, 2006 10:38 am
Posts: 4
ehm...
Quote:
The classes already are in the classpath; in fact if I don't use a composite identifier the tool wonderfully generates a perfect schema.

replace with "I THINK the classes SHOULD be in the classpath, let me ACTUALLY CHECK IT! oh my the'y're not there!!! How could that happen???". Thanks a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 8:05 am 
Newbie

Joined: Fri Jul 28, 2006 10:38 am
Posts: 4
ehm...
Quote:
The classes already are in the classpath; in fact if I don't use a composite identifier the tool wonderfully generates a perfect schema.

replace with "I THINK the classes SHOULD be in the classpath, let me ACTUALLY CHECK IT! oh my the'y're not there!!! How could that happen???". Well looks like I only assumed without checking. Thanks a lot


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.