-->
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.  [ 3 posts ] 
Author Message
 Post subject: hibernate.hbm2ddl.auto
PostPosted: Thu Sep 09, 2004 2:41 pm 
Regular
Regular

Joined: Sat May 29, 2004 2:16 pm
Posts: 81
Hibernate version:
2.1

Mapping documents:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name = "hibernate.show_sql">false</property>

<property name = "hibernate.hbm2ddl.auto">update</property>

<!-- mapping files -->
<mapping resource = "escola/Relatorio.hbm.xml"/>
<mapping resource = "escola/Acessorios.hbm.xml"/>
<mapping resource = "escola/Turma.hbm.xml"/>
<mapping resource = "escola/EducacaoArtistica.hbm.xml"/>
<mapping resource = "escola/EducacaoFisica.hbm.xml"/>
<mapping resource = "escola/EducacaoMoralEReligiosa.hbm.xml"/>
<mapping resource = "escola/EducacaoMusical.hbm.xml"/>
<mapping resource = "escola/EducacaoTecnologica.hbm.xml"/>
<mapping resource = "escola/EducacaoVisualETecnologica.hbm.xml"/>
<mapping resource = "escola/EstudoDoMeio.hbm.xml"/>
<mapping resource = "escola/ExpressaoArtistica.hbm.xml"/>
<mapping resource = "escola/Matematica.hbm.xml"/>
<mapping resource = "escola/LinguaPortuguesa.hbm.xml"/>
<mapping resource = "escola/LEI.hbm.xml"/>
<mapping resource = "escola/Q9.hbm.xml"/>
<mapping resource = "escola/Q10.hbm.xml"/>
<mapping resource = "escola/Q12.hbm.xml"/>
<mapping resource = "escola/Q17.hbm.xml"/>
<mapping resource = "escola/Q19.hbm.xml"/>
<mapping resource = "escola/Q22Al.hbm.xml"/>
<mapping resource = "escola/Q22Disc.hbm.xml"/>
<mapping resource = "escola/Q22EE.hbm.xml"/>
<mapping resource = "escola/Q22Esc.hbm.xml"/>
<mapping resource = "escola/Q23.hbm.xml"/>
<mapping resource = "escola/Q34.hbm.xml"/>
<mapping resource = "escola/Utilizador.hbm.xml"/>
</session-factory>
</hibernate-configuration>


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:
MySql 4.0.12-nt

Debug level Hibernate log excerpt:

I read in manual's ch 3.5 that we can use hibernate.hbm2ddl.auto with update, which i adopted:
<property name = "hibernate.hbm2ddl.auto">update</property>
This is great because i can have data in database and at the same time update it without any loss of data.
But i watched this:

...
19:33:03,375 DEBUG SchemaUpdate:133 - alter table q22Al add index (matematica_id), add constraint FK64FDE7C7F49A5CE foreign key (matematica_id) references matematica (id)
...
I mean, the database update creates a constraint: i wonder if i should worry about that, if that, in any way, may affect my data and the overall natural flow of my app
Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 2:44 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Automatic database schema update _may_ be useful in development, but never in production or with anything else that involves important data. It's just too fragile and depends on too many variables.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 2:47 pm 
Regular
Regular

Joined: Sat May 29, 2004 2:16 pm
Posts: 81
I see
My idea is that i'm making this app by stages, and only on second stage i'd add more objs, but then i'de to expand database mannually, acording to what you recomend...


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