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.  [ 4 posts ] 
Author Message
 Post subject: Controlling POJO code generation
PostPosted: Wed Jul 30, 2008 1:49 pm 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
Hibernate version: hibernate-annotations 3.3.1, hibernate-commons-annotations 3.3.0.ga, hibernate-entitymanager3.3.2, hibernate-core 3.2

Name and version of the database you are using: Orcale XE 10g Release 2 (10.2)

I am using Hibernate Tools 3.2.2.Beta1 with Eclipse 3.3.2

I am new to Hibernate Tools and have read Chapter 6 of the Hibernate Tools Reference Guide. However, I don't know how to use the plugin to generate my POJOs based off of existing hbm.xml files.



I first generated my POJOs via the reverse engineer from JDBC connetion option in the HTools Eclipse plugin. This created my annotated POJOS, hbm files, and a new cfg file. And then I modified my hbm files with meta tag as describe in the HTools Reference Guide 6.1. At this point I want to disregard the generated POJOs created from the reverse engineer option and then I want to re-generated new annotated POJOs from the new marked-up meta tag hbm files. Maybe this is not the best way to do this. If so can someone give an alternative solution?

Does the HTools plugin support <hbm2java>? If so, I do I use it?

Any advise on how to do this through the HTools plugin for Eclipse is greatly appreicated!

Thanks!

_________________
pouncilt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 10:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
not sure why you generate pojo's on the first run if you just wanted the hbm.xml's ?

Anyhow, for the second run just dont enable jdbc reverse engineering and it will pick up all the mappings instead.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 11:51 am 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
max wrote:
not sure why you generate pojo's on the first run if you just wanted the hbm.xml's ?

Anyhow, for the second run just dont enable jdbc reverse engineering and it will pick up all the mappings instead.


I generated the pojos on the first because I was exploring the capabilities of the HTools plugin with Eclipse. Just trying to get a feel of what the tool can do. After I was comfortable with the tool I wanted to really configure the way my pojos were created.

To you point on not enabling the jdbc reverse engineering, I did try that. Here is the senario:
I have successfully created a Hibernate configuration file and Hibernate console through the wizard. I have added my hbm.xml files to the configuration so that the Hibernate configuration shows all my new hbm configurations. None of the pojos defined in the configuration hbm.xml file is actually created.

However, I get the following error when I try what you suggest:

org.hibernate.console.HibernateConsoleRuntimeException: Could not load AnnotationConfiguration
Could not load AnnotationConfiguration
org.hibernate.MappingException: Unable to load class declared as <mapping class="com.aviall.edi.modules.order.process.core.persistence.generated.valueobjects.TransactionCommands"/> in the configuration:
Unable to load class declared as <mapping class="com.aviall.edi.modules.order.process.core.persistence.generated.valueobjects.TransactionCommands"/> in the configuration:
org.hibernate.MappingException: Unable to load class declared as <mapping class="com.aviall.edi.modules.order.process.core.persistence.generated.valueobjects.TransactionCommands"/> in the configuration:
Unable to load class declared as <mapping class="com.aviall.edi.modules.order.process.core.persistence.generated.valueobjects.TransactionCommands"/> in the configuration:
java.lang.ClassNotFoundException: com.aviall.edi.modules.order.process.core.persistence.generated.valueobjects.TransactionCommands
com.aviall.edi.modules.order.process.core.persistence.generated.valueobjects.TransactionCommands


Why do I get this error?

Thanks!

_________________
pouncilt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 2:09 pm 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
I found my mistake. In my cfg.xml file it was referencing the pojo classes instead of the hbm.xml files. I am now able to generate my pojos based on my hbm.xml files.

Thanks!

_________________
pouncilt


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