-->
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: hbm2java failed with composite id
PostPosted: Sun Sep 04, 2005 7:01 pm 
Beginner
Beginner

Joined: Wed Mar 16, 2005 4:07 pm
Posts: 22
I am using 3.1.0alpha5 hibernate-tools. when trying to use hbm2java to generate POJOs, one of the mapping file has a composite id as the following:
<hibernate-mapping package="foo.bar">
<class name="LoanBillingHistory" table="LoanBillingHistory">
<composite-id class="LoanBillingHistoryPK" name="Id">
<key-many-to-one
class="LoanBill"
column="LoanBillID"
name="LoanBillID"
/>
<key-property
column="ProductBalanceID"
name="ProductBalanceID"
type="integer"
/>
</composite-id>
...

hbm2java throws the following exception. it appears that it's trying to find the component id class which is generated by itself, therefore not in the classpath.

org.hibernate.MappingException: component class not found: foo.bar.LoanBillingHistoryPK
at org.hibernate.mapping.Component.getComponentClass(Component.java:105)
at org.hibernate.tuple.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:140)
at org.hibernate.tuple.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:40)
at org.hibernate.tuple.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:33)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:126)
at org.hibernate.mapping.Component.getType(Component.java:160)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:151)
at org.hibernate.cfg.Configuration.iterateGenerators(Configuration.java:571)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:676)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:87)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:55)
at org.hibernate.tool.ant.Hbm2DDLGeneratorTask.execute(Hbm2DDLGeneratorTask.java:39)

is there a way to fix it? (I could compile the generated classes and run the hbm2java again. but that's kind of ugly...)

also the class LoanBillingHistory and its composite id class LoanBillingHistoryPK seem to be generated. don't know what the exception implies?

thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 04, 2005 8:17 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Are you really using hbm2java? The stack trace only has hbm2ddl in it.


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.