-->
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: schema export - DEBUG Messages
PostPosted: Wed Feb 21, 2007 12:50 pm 
Newbie

Joined: Wed Feb 14, 2007 1:46 pm
Posts: 3
Hi guys, I'm simply persisting an entity in my database (I'm using Derby but I dont think it matters).

When I save it using Hibernate functions Save(entity), I got a message from the logger that I'm missing some stuff and there is error.

But, when I verify if the entity was added to the db, it works! The entity is now persisted in the DB.

So I would like to know what thoses messages mean, and by the way why it takes so long to save an entity like 10 seconds. (Maybe the delay is a consequence of the logger message)...

Thanks

Messages :

11:33:47,750 INFO SchemaExport:154 - Running hbm2ddl schema export
11:33:47,750 DEBUG SchemaExport:170 - import file not found: /import.sql
11:33:47,750 INFO SchemaExport:179 - exporting generated schema to database
11:33:47,750 DEBUG SchemaExport:303 - drop table ETUDIANTS if exists
11:33:47,812 DEBUG SchemaExport:288 - Unsuccessful: drop table ETUDIANTS if exists
11:33:47,812 DEBUG SchemaExport:289 - Syntax error: Encountered "if" at line 1, column 22.
11:33:47,812 DEBUG SchemaExport:303 - create table ETUDIANTS (ETUDIANT_ID bigint not null, ETUDIANT_PRENOM varchar(255), ETUDIANT_NOM varchar(255), ETUDIANT_CODE_PERMANENT varchar(255) not null, ETUDIANT_COURRIEL varchar(255), ETUDIANT_APPELLATION varchar(255), ETUDIANT_TELEPHONE varchar(255), ETUDIANT_PROGRAMME varchar(255), ETUDIANT_STATUS_LOG790 varchar(255), ETUDIANT_STATUS_PCL310 varchar(255), ETUDIANT_COTE_LOG790 varchar(255), primary key (ETUDIANT_ID), unique (ETUDIANT_CODE_PERMANENT))
11:33:47,968 ERROR SchemaExport:274 - Unsuccessful: create table ETUDIANTS (ETUDIANT_ID bigint not null, ETUDIANT_PRENOM varchar(255), ETUDIANT_NOM varchar(255), ETUDIANT_CODE_PERMANENT varchar(255) not null, ETUDIANT_COURRIEL varchar(255), ETUDIANT_APPELLATION varchar(255), ETUDIANT_TELEPHONE varchar(255), ETUDIANT_PROGRAMME varchar(255), ETUDIANT_STATUS_LOG790 varchar(255), ETUDIANT_STATUS_PCL310 varchar(255), ETUDIANT_COTE_LOG790 varchar(255), primary key (ETUDIANT_ID), unique (ETUDIANT_CODE_PERMANENT))
11:33:47,968 ERROR SchemaExport:275 - Table/View 'ETUDIANTS' already exists in Schema 'ME'.
11:33:47,968 INFO SchemaExport:196 - schema export complete

/****************************/
Hibernate.cfg.xml
/********************************/

<?xml version="1.0"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->
<!-- Dans IJ.bat - Pour creer la bd: connect 'jdbc:derby://localhost:1527/c:/DOGFDB;create=true;user=me;password=mine'; -->
<!-- Avec Ant dans dos : ant run -Daction=store -->
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
<property name="connection.url">jdbc:derby://localhost:1527/c:/DOGFDB</property>
<property name="connection.username">me</property>
<property name="connection.password">mine</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">10</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create-drop</property>

<!-- Echo all executed SQL to stdout -->
<!-- <property name="show_sql">true</property> -->


<mapping resource="domain/Etudiant.hbm.xml"/>

</session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 23, 2007 4:14 am 
Beginner
Beginner

Joined: Mon Jan 22, 2007 1:16 pm
Posts: 21
Do you really want to drop and recreate your database tables every time you startup Hibernate?

If all you want is to persist an entity to your database, then you probably want to remove/comment out this line in your Hibernate.cfg.xml :

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create-drop</property>


When Hibernate first startsup, ie. when it creates SessionFactory and opens your session, it always takes a few seconds.

regards,
Mark


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 23, 2007 5:35 am 
Regular
Regular

Joined: Fri May 12, 2006 4:05 am
Posts: 106
Hi,

looks like Derby doesn't understand the "if exists"-clause on the drop table-statement.

But why are you using the HSQL-Dialect
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
when running Derby???? This way Hibernate is certain to generate incompatible SQL!

Try using
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
and see if it fixes the Problem!


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.