-->
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.  [ 1 post ] 
Author Message
 Post subject: [Newbie]: HBM2DDL_AUTO value for create AND update tables
PostPosted: Mon Feb 06, 2006 7:12 am 
Newbie

Joined: Wed Jan 11, 2006 10:28 am
Posts: 19
Location: Fano, Italy
Sorry for a perhaps stupid question, but i'm unable to find a response for my question.
It's possible to set up hibernate for use an existing table in my database if this table exists, and to create the same table if not exists?

At this time i'm using
sessionFactory = new Configuration().setProperty(Environment.HBM2DDL_AUTO, "create")
.configure().buildSessionFactory();
but this creates from scratch all the tables: "update" refresh existing tables, and throws an exception if this tables not exists.

As example: i have created a simple class Person and a simple class Event (from Hibernate Tutorial), and i would that my program creates the tables for store my classes only when i need to store some instances of my classes.

My program does run like this:
1) I launch my program and i create som Person Objects -> hibernate creates a Person table and store my objects
2) I close my program and run again.
3) I create a new Person object and some Events object -> hibernate update Person table adding a new object and create Events table with my objects.

It's possible to do that?
Sorry for my not clear explaination, but i'm at the first experiences with hibernate... please be patients ;)

Hibernate version: 3.1.2

Name and version of the database you are using: HSQLDB 1.8.0


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.