-->
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.  [ 4 posts ] 
Author Message
 Post subject: Don't reinitialized table
PostPosted: Tue Aug 30, 2005 6:11 am 
Beginner
Beginner

Joined: Thu Aug 11, 2005 11:16 am
Posts: 20
Hi everybody,

I beginning to use hibernate and i have some question if somebody can help me i am very happy ! :)

I have start to create my mapping xml file .hbm described my tables on my database oracle described in hibernate.properties. I starting all described in hibernate.cfg.xml by an classe java who contained :

public static void main(String[] args) throws HibernateException, net.sf.hibernate.HibernateException, InstantiationException, IllegalAccessException, SQLException {

session = (Session) HibernateUtil.currentSession();
tx= (Transaction) session.beginTransaction();

That's is very good , it's create all the table in database oracle described in file hbm BUT the problem is when i insert a element in base and i restart application hibernate, my tables are recreated and reinitialized. why ?

And second question, how can I check that the property which I want to insert in my table does not exist? by request ?


thank you in advance, Cordially,

cyril.


Hibernate version: 3.0

Name and version of the database you are using: oracle


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 7:43 am 
Regular
Regular

Joined: Sun May 08, 2005 2:48 am
Posts: 118
Location: United Kingdom
1) Whats in your hibernate.properties file ? Please paste is here.

I think there is an option to create tables on startup, maybe you enabled it thinking it would only do it the first time it runs, not every time it runs.

something like "autoddlgen" or something...



2) The property ? You insert rows into tables, these rows are usualy based on objects, its common for one row to be one object. Maybe you can explain what you mean better ?

You can lookup an object with:

Session.get(MyObject.class, new Integer(1))

to get the instance number 1 of the primary key / id.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 8:06 am 
Beginner
Beginner

Joined: Thu Aug 11, 2005 11:16 am
Posts: 20
Yes cool it's that hbm2ddl create i have comment it ! it's good thks u ! how i give u an credit ?

#hibernate.hbm2ddl.auto create
hibernate.hbm2ddl.auto update

And for the property i have an table AC and there are an param name = axis , and i want to know if in my table AC i have already an axis in param name .

thks u again,

_________________
Cyril,


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 8:16 am 
Regular
Regular

Joined: Sun May 08, 2005 2:48 am
Posts: 118
Location: United Kingdom
cyr2005 wrote:
And for the property i have an table AC and there are an param name = axis , and i want to know if in my table AC i have already an axis in param name .


If thats the 2nd problem, please re-phrase that so I can understand better.


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