-->
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: Generating hmb and schema
PostPosted: Wed Nov 08, 2006 4:27 pm 
Beginner
Beginner

Joined: Thu Oct 23, 2003 1:17 pm
Posts: 44
I've been looking for a few hours now, and it seems like with all the tools, there must be a way, but I just can't find it.

I have an already existing object model and would like to generate the hbm files and schema for using hibernate. I can't seem to find a tool that does this well. I tried out the JBoss IDE that has the tools build in, but can only get it to generate the hbm for a single class, and it doesn't even generate the hbm with all the fields.

Am I missing something? Doing something wrong?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 4:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
from .class/.java we don't have anything (yet).

People normally uses annotations to transform their java model to a persistent java model.

The ide can definitly be improved in this area - bug reports and patches are welcome in our jira!

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 6:48 pm 
Beginner
Beginner

Joined: Thu Oct 23, 2003 1:17 pm
Posts: 44
max wrote:
from .class/.java we don't have anything (yet).


When you say "we", you mean JBoss? Is there anything out there that does?

Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 7:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
From .java/.class has the problems of limited meta data to generate a clean HBM. Options are usually 1) Annotations or 2) Xdoclet. In the past H2 Tools package had a class2hbm tool which was very rough and not maintained for some time. It was dropped when going to H3 tools set. You could try it I guess but don't expect much of a result - it will require editing. If you have the domain model then a database schema might be faily easy to create. Then the DB could be reverse engineered. Only need to modify the result to fit your domain model - might be faster. In anycase, you have some work to do.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 8:33 pm 
Beginner
Beginner

Joined: Thu Oct 23, 2003 1:17 pm
Posts: 44
Great, thanks for the info Max and David.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 3:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
we as in the Hibernate project.

as david explains class2hbm were dropped since it had conceptual limitations and too many bugs. Alot of these were "fixed" when jdk1.5 got generics which allow you to deduce more about the system.

One of the things I would like to do is to have an option in Hibernate Annotations to not require @Entity and @Id on entities which then can be used to have a better class2hbm.

Another alternative is to depend on eclipses javamodel and enhance the hbm.xml wizard to provide options to generate for the properties in there.

_________________
Max
Don't forget to rate


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.