-->
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.  [ 2 posts ] 
Author Message
 Post subject: hibernate.hbm2ddl.auto create-update import.sql
PostPosted: Tue May 16, 2006 10:11 am 
Newbie

Joined: Tue May 16, 2006 9:50 am
Posts: 1
I would like hibernate to initialise my database using mapping (to create tables) and import.sql (to insert init datas).
I've put this property <property name="hibernate.hbm2ddl.auto">create</property> .
It works great, but each time i reload my webapp, my datas are deleted.

Using 'update' instead of 'create', works for the tables, but doesn't read the import.sql file.

The solution, for the moment, is :
1/ put property value to create (create table+datas),
2/ comment the property or set it to update.

But it is not really 'user-friendly', it's a portlet and i don't want everybody to configure my hibernate property file each time after the first deploy.

I think two solutions can be implemented in the code of hibernate:

1/ add a create-update value
If tables don't exist apply create value (create tables and load import.sql), if exist apply update value (don't reload import.sql)

2/ modify update
Make it loading the import.sql file just after the create table call (but load the file just one time).

My Question:
Does anybody have the same problem (or the solution) to avoid users modifying the property after the first deploy ?

Cheers,
Eric BOURDIN

Hibernate version: 3.1.3


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 11:00 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
In my opinion this is merely a function to ease development.

For production use, I recommend to use a script to create the tables and to call it explicitely.

Best Regards

Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.