-->
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.  [ 10 posts ] 
Author Message
 Post subject: hbm2java can only be used with Hibernate2?
PostPosted: Sun Oct 23, 2005 7:07 pm 
Newbie

Joined: Sun Oct 23, 2005 7:03 pm
Posts: 12
Is it true that hbm2java can only be used with Hibernate2?
Is there an equivalent in Hibernate3?
Generally speaking, what's the good mapping and POJO data object generating too for Hibernate3?

Thanks a lot!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 23, 2005 7:37 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
hbm2java works for both hibernate 2 and 3. the "2" is just a play on words ... hibernate-to-java

what does your third question mean?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 24, 2005 1:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
correction:

Use the tools version that matches the hibernate major version.

Hibernate 2 tools with hibernate 2 and hibernate 3 tools with hibernate3.

hibernate 2 tools is not maintained anymore - only hibernate 3 tools at http://tools.hibernate.org is being developed.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 6:10 pm 
Newbie

Joined: Sun Oct 23, 2005 7:03 pm
Posts: 12
Thanks for Dennis and Max.
I'm pretty new to Hibernate and its Tool. So any information will be appreciated!


Max:
I have tried the Hibernate 3 Ant Tool, and was able to generate the POJO java classes based on the hbm.xml files.
Now I'm trying to generate hbm.xml files from the database schema. I understand I should use the 'reverse engineering' strategy in Hibernate 3 Ant Tool, right? But I can't make it right by following the only example in the document(http://www.hibernate.org/hib_docs/tools/ant/).

Here is what I have:
<target name="ddl2xml" description="Generate .java from .hbm files.">
<taskdef
name="ddl2xml"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref ="compile-classpath"
/>

<ddl2xml destdir="${gen.dir}">
<jdbcconfiguration configurationfile="${webapp.dir}/WEB-INF/classes/hibernate.cfg.xml"/> </ddl2xml>
</target>

It doesn't generate anything.
I know my question seems dumb, but I cannot find any more examples of how to do it right. (Again, I'm trying to generate mapping files from DB schema)

Please advice.


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 7:19 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
does hibernate.cfg.xml have any mapping elements? this may explain the blank output.

for your other question, you are going to need a revengfile attribute on the jdbcconfiguration element.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 3:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
on the contrary if hibernate.cfg.xml had any mappings it would definitly generate some output since they are read like any other cfg.xml.

it must because it cannot read the metadata from the database.

e.g. if on oracle, and you use a schema name remember to use uppercase as its case sensitive.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 12:37 pm 
Newbie

Joined: Sun Oct 23, 2005 7:03 pm
Posts: 12
Thanks again for Dennis and Max!


What kind of mapping do I need in my Hibernate.cfg.xml?
mapping resource? Where can I find some examples or tutorials?

again, I need to generate hbm.xml from my database tables.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 12:39 pm 
Newbie

Joined: Sun Oct 23, 2005 7:03 pm
Posts: 12
And which 'exporter' should I use? hbm2hbmxml?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 3:11 pm 
Newbie

Joined: Sun Oct 23, 2005 7:03 pm
Posts: 12
OK, I made the hbm2hbmxml work! Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 3:21 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
ok, for some reason i though he was doing an hbm2ddl .


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