-->
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: Generate DB-Mapping, Java Source/Classes at runtime
PostPosted: Fri Oct 01, 2004 3:57 am 
Newbie

Joined: Fri Oct 01, 2004 3:45 am
Posts: 3
Hi there,

In my application the mapping information isn't available at design/compile time.

Is it possible to generate the DB-Tables, Java Source and Classes at runtime based on a mapping that I would generate also at runtime? Does anybody did this before?

Couldn't find much information how to use the Hibernate Tools directly in the java code and not in Ant....

thanks
michael


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 01, 2004 3:23 pm 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Maybe this helps:

You could call the ant tasks directy from your Java Code.

Or write an ant taks generating the hbm.xml files and than do the rest with the hibernate ant tasks.

HTH
Ernst


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 3:18 am 
Newbie

Joined: Fri Oct 01, 2004 3:45 am
Posts: 3
Thanks,
but am I right that there is now way to directly use Hibernate's API without ant to generate the various files?

greetings
michael


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 3:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you can configure hibernate 100% programmatically, but hibernate2 is dependent on having a classloader that gives you classes that matches the mapped classes.

In Hibernate3 you have the possibility to have dynamic mappings which basically just allows you to use untyped Map's instead of concrete classes.

(hibernate3 is still in alpha stage)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 7:43 am 
Newbie

Joined: Fri Oct 01, 2004 3:45 am
Posts: 3
Cool that sounds interesting.

Last question:
Are the dynamic Map features already documented somewhere or do I have to browse the API (which package) and figure out how it works?

thanks
michael


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 7:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can just use <dynamic-class> and <dynamic-component> in the Mapping file and drop the classname - I'd say just try it and experiment a little.


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.