-->
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: POJOs <--> xml def <--> SQL : How do you do it?
PostPosted: Sat Oct 09, 2004 8:09 am 
Newbie

Joined: Fri Oct 08, 2004 9:26 am
Posts: 17
Once a new datatype is all set up, hibernate is lovely. It always takes me ages to set up a new datatype though, makeing sure the three different elements are all in sync.

I seem to do it a different way round everytime-

How you do it? What is the best/easiest way of generating? I would love to write the XML, press a button and have the POJOs and database tables created by magic.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 09, 2004 9:59 am 
Newbie

Joined: Thu Sep 25, 2003 7:21 pm
Posts: 17
Quote:
I would love to write the XML, press a button and have the POJOs and database tables created by magic.


You can do that, from the .hbm.xml file you can generate the database schema with the hbm2ddl script (or the net.sf..hibernate.tool.hbm2ddl.SchemaExportTask ant task)

similarly you can generate java code from the same xml file with hbm2java (or the net.sf.hibernate.tool.hbm2java.Hbm2JavaTask ant task)

I personally prefer the xdoclet approach though


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 09, 2004 10:06 am 
Newbie

Joined: Fri Oct 08, 2004 9:26 am
Posts: 17
why do you prefer xdoclet? is it just a personal thing or does it actaully make life easier/create better code/save time?

I really want to get to grips with hibernate as I think it could be a very useful tool for years to come.

thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 09, 2004 10:33 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
it depends on how you are working?
Are you doing db schema first? domain model first?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 09, 2004 10:53 am 
Newbie

Joined: Fri Oct 08, 2004 9:26 am
Posts: 17
always domain model first.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 09, 2004 12:50 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
do you know http://www.hibernate.org/102.html ?
what is sure is that you can use schemaexport.

now try xdoclet to see if it fit to generate mapping files...

The problem with xdoclet is that it will do the same job that jsr 175 in hibernate3;

Quote:
JDK 1.5 Enhancements
The new JDK has been released as a preview earlier this year and we expect a slow migration to the new 1.5 platform throughout 2004. While Hibernate3 still runs perfectly with JDK 1.2, Hibernate3 will make use of some new JDK features. JSR 175 annotations, for example, are a perfect fit for Hibernate metadata and we will embrace them aggressively. We will also support Java generics, which basically boils down to allowing typesafe collections.


Mapping files are not so hard to write...

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


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.