-->
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: Use Hibernate for Create, Drop, or Alter tables/columns?
PostPosted: Tue Dec 13, 2005 7:10 pm 
Beginner
Beginner

Joined: Wed Nov 30, 2005 4:58 pm
Posts: 22
Location: Austin, TX
Since doing so would mean the mapping xml would have to change to match the new structure and classes would need new properties and getters/setters, I'm guessing it is not supported. I have not found any specific information about this, but it appears Hibernate is built for running queries against a DB not changing the structure of the DB. Is that right, or have I missed something?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 5:27 pm 
Beginner
Beginner

Joined: Wed Nov 30, 2005 2:41 pm
Posts: 29
you're right, Hibernate expects the db structure to be fixed. It provides the capability to store & retrieve Java objects to/from a relational db without having to write any SQL, and to be able to switch between a (large) variety of databases with no change to your application code.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 6:59 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Quote:
you're right, Hibernate expects the db structure to be fixed.


Bull. Use <property name="hbm2ddl.auto">update</property> but read the docs and realize the limitations of automatic DB schema evolution first.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 8:40 pm 
Beginner
Beginner

Joined: Wed Nov 30, 2005 2:41 pm
Posts: 29
i read the docs, and it says "update" is a valid value for hbm2ddl.auto, but doesn't say what it does. One could infer it will update the db to match the existing *.hbm.xml files. But this only happens at SessionFactory build time, and presumes one has already updated everything else appropriately. It certainly doesn't support on-the-fly db changes, which is how i interpreted the original question.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 8:43 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
What is an "on the fly" database schema update?


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.