-->
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.  [ 7 posts ] 
Author Message
 Post subject: Middlegen-Hibernate-r5 and Hibernate SchemaExport
PostPosted: Tue Mar 17, 2009 2:12 pm 
Newbie

Joined: Tue Mar 17, 2009 7:49 am
Posts: 5
I have downloaded Middlegen-Hibernate-r5 and have successfully generated the hibernate mapping files (Reservation.hbm.xml Person.hbm.xml Flight.hbm.xml) to be used by the schema export.

I then run the following:

java -cp %CLASSPATH% org.hibernate.tool.hbm2ddl.SchemaExport --properties=hibernate.properties Reservation.hbm.xml Person.hbm.xml Flight.hbm.xml

And I get the following output/error:

Mar 17, 2009 2:03:56 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.3.1.GA
Mar 17, 2009 2:03:56 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Mar 17, 2009 2:03:56 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : javassist
Mar 17, 2009 2:03:56 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Mar 17, 2009 2:03:56 PM org.hibernate.cfg.Configuration addFile
INFO: Reading mappings from file: Reservation.hbm.xml
Mar 17, 2009 2:03:57 PM org.hibernate.util.DTDEntityResolver resolveEntity
SEVERE: Don't use old DTDs, read the Hibernate 3.x Migration Guide!
Mar 17, 2009 2:03:57 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: airline.hibernate.Reservation -> reservations
Mar 17, 2009 2:03:57 PM org.hibernate.cfg.Configuration addFile
INFO: Reading mappings from file: Person.hbm.xml
Mar 17, 2009 2:03:57 PM org.hibernate.util.DTDEntityResolver resolveEntity
SEVERE: Don't use old DTDs, read the Hibernate 3.x Migration Guide!
Mar 17, 2009 2:03:57 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: airline.hibernate.Person -> persons
Mar 17, 2009 2:03:57 PM org.hibernate.cfg.Configuration addFile
INFO: Reading mappings from file: Flight.hbm.xml
Mar 17, 2009 2:03:57 PM org.hibernate.util.DTDEntityResolver resolveEntity
SEVERE: Don't use old DTDs, read the Hibernate 3.x Migration Guide!
Mar 17, 2009 2:03:57 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: airline.hibernate.Flight -> flights
Mar 17, 2009 2:03:57 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.SQLServerDialect
Mar 17, 2009 2:03:57 PM org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: airline.hibernate.Flight.reservations -> reservations
Mar 17, 2009 2:03:57 PM org.hibernate.tool.hbm2ddl.SchemaExport main
SEVERE: Error creating schema
org.hibernate.MappingException: component class not found: airline.hibernate.ReservationPK
at org.hibernate.mapping.Component.getComponentClass(Component.java:127)
at org.hibernate.tuple.component.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:156)
at org.hibernate.tuple.component.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:66)
at org.hibernate.tuple.component.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:61)
at org.hibernate.tuple.component.ComponentEntityModeToTuplizerMapping.<init>(ComponentEntityModeToTuplizerMapping.jav
a:76)
at org.hibernate.tuple.component.ComponentMetamodel.<init>(ComponentMetamodel.java:73)
at org.hibernate.mapping.Component.buildType(Component.java:175)
at org.hibernate.mapping.Component.getType(Component.java:168)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:175)
at org.hibernate.cfg.Configuration.iterateGenerators(Configuration.java:743)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:854)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:128)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91)
at org.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:474)
Caused by: java.lang.ClassNotFoundException: airline.hibernate.ReservationPK
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:123)
at org.hibernate.mapping.Component.getComponentClass(Component.java:124)
... 13 more
org.hibernate.MappingException: component class not found: airline.hibernate.ReservationPK
at org.hibernate.mapping.Component.getComponentClass(Component.java:127)
at org.hibernate.tuple.component.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:156)
at org.hibernate.tuple.component.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:66)
at org.hibernate.tuple.component.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:61)
at org.hibernate.tuple.component.ComponentEntityModeToTuplizerMapping.<init>(ComponentEntityModeToTuplizerMapping.jav
a:76)
at org.hibernate.tuple.component.ComponentMetamodel.<init>(ComponentMetamodel.java:73)
at org.hibernate.mapping.Component.buildType(Component.java:175)
at org.hibernate.mapping.Component.getType(Component.java:168)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:175)
at org.hibernate.cfg.Configuration.iterateGenerators(Configuration.java:743)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:854)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:128)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91)
at org.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:474)
Caused by: java.lang.ClassNotFoundException: airline.hibernate.ReservationPK
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:123)
at org.hibernate.mapping.Component.getComponentClass(Component.java:124)
... 13 more


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 19, 2009 9:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
any reason why you don't use Hibernate tools instead of the old middlegen ? :)

anyway, the error shows you haven't compiled the classes and made them available on its classpath.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 19, 2009 9:52 am 
Newbie

Joined: Tue Mar 17, 2009 7:49 am
Posts: 5
Max,

Thanks for the help, and please excuse my ignorance as I’m very new to all this (Hibernate and Java), but what classes are you talking about?

BTW, we are trying to use Hibernate to simply generate DDL from XML and nothing else. From other post in the forums I gather that this is not how it’s intended to be used, am I correct?

Thanks,
Mark


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 19, 2009 8:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well hibernate can do that but why not use it as your persistence layer when you apparently already written the mapping files ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 20, 2009 1:15 pm 
Newbie

Joined: Tue Mar 17, 2009 7:49 am
Posts: 5
Because I don't need a persistence layer. I'm only concerned with the database. All I need is a tool/utility that will take XML and spit out DDL. I thought Hibernate would do that, but it doesn't seem to be working for me.

Mark


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 22, 2009 6:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
It is a combination of the XML (or mapping information) and the domain model. To me, it really only makes sense if your using hibernate as the persistence layer. There are other tools around that are used as a middle definition solution that can the "Spit out the DDL". I would evaluate a specialise tool in that space instead.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 22, 2009 7:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
To save you some trouble - try out

http://db.apache.org/ddlutils/

as a starting point.,


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