-->
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.  [ 5 posts ] 
Author Message
 Post subject: Runtime creation of table and mapping
PostPosted: Thu May 03, 2007 10:50 am 
Newbie

Joined: Fri Mar 03, 2006 11:03 am
Posts: 19
Location: India
Hi Hbm users,

Can anyone tell me how to create any table while runtime and use it like i'm having other *.hbm.xml configuration.
Please help me out.

Thanks in advance

-Vikash


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 11:35 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
You cant. Nore should you ever want to.

_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 04, 2007 6:37 am 
Newbie

Joined: Fri Mar 03, 2006 11:03 am
Posts: 19
Location: India
So is it the weakness of Hibernate that i cant perform create table query and can maintain it like others.

-Vikash

_________________
get hibernate & get addicted


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 04, 2007 8:12 am 
Newbie

Joined: Thu Apr 19, 2007 1:46 am
Posts: 10
Hi,

This is the code for it.
Configuration config = new Configuration().configure();
SchemaExport sch = new SchemaExport(config);
sch.create(true, true);
SessionFactory sessionFactory = config.buildSessionFactory();

It drops and creates new tables everytime you run it.
sch.create(true, true);
This setting shows you the generated SQL
as well as DDL is immediately executed in the datadase
Though you can change the settings as you like.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2007 2:08 am 
Newbie

Joined: Fri Mar 03, 2006 11:03 am
Posts: 19
Location: India
Hi Gurpreet,

Wont it be very heavy process. and even if it deletes and creates new table so i'll be lose'g my data for those tables.
And this ExportSchema seems like that its just updating the schema details which is not what i want. I want to change the schema like create and alter which will be used so offen'ly that it should be easy to do.


Anyways thanks for yr so good reply.
-Vikash

_________________
get hibernate & get addicted


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