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
|