-->
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.  [ 2 posts ] 
Author Message
 Post subject: Database emptied when launching tomcat
PostPosted: Mon Dec 26, 2005 2:59 am 
Newbie

Joined: Mon Dec 26, 2005 2:39 am
Posts: 1
Hi everybdy and sorry for this ask for help
but i'm stuck on this.
I've generated some classes from an oarcle 10g database using hibernate Tools and try to launch tomcat 5.0 from myeclipse.

It's launched but database is emptied (Data is deleted in every table, but tables aren't dropped..) when executing
Code:
Session session = HibernateUtil.currentSession();

which is
Code:
public static Session currentSession()
        throws HibernateException {
   Session s = (Session) session.get();
   // Ouvre une nouvelle Session, si ce Thread n'en a aucune
   if (s == null) {
   s = sessionFactory.openSession();
   session.set(s);
   }
   return s;
   }

No exception handled...
Only data is deleted and as i need it to login to my webapp i'm confused...

In my stack corresponding to the call to currentsession i have these 3 threads:
Code:
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0]
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1]
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2]


Here is my hibernate.cfg.xml (if it can help) :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>

   <!-- Settings for a local HSQL (testing) database. -->
        <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
        <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@192.168.3.75:1521:orcl</property>
        <property name="connection.username">ALISSCONF</property>
        <property name="connection.password">ALISSCONF</property>

        <!-- Use the C3P0 connection pool. -->
        <property name="c3p0.min_size">3</property>
        <property name="c3p0.max_size">5</property>
        <property name="c3p0.timeout">1800</property>
   
        <!-- Disable second-level cache. -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
        <property name="cache.use_query_cache">false</property>
        <property name="cache.use_minimal_puts">false</property>
        <property name="max_fetch_depth">3</property>
   
        <!-- Print SQL to stdout. -->
        <property name="show_sql">true</property>
        <property name="format_sql">true</property>
   
        <!-- Drop and then re-create schema on SessionFactory build, for testing. -->
        <property name="hbm2ddl.auto">create</property>
   
        <!-- Bind the getCurrentSession() method to the thread. -->
        <property name="current_session_context_class">thread</property>

        <!-- Hibernate XML mapping files -->
       
   
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbVisaRules.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbWebuser.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbTierAllowance.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbTimeoutCategory.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbSpecialMessage.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbSpecialmsgTranslation.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbTerminal.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbSecurquestTranslation.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbParameterKeys.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbScreen.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbSecurityQuestion.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbGroup.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbGroupkiosk.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbIssuancecountryAllowed.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbKiosk.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbLanguage.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbLanguageAllowed.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbNationalityAllowed.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbParameter.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbCityTranslation.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbClassMapping.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbCountry.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbCountryTranslation.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbDocument.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbDocumentAllowed.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbDocumentTranslation.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbFfcard.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbFfcardAllowed.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbFftier.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbAirline.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbAirport.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbAirportServed.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbAirportTranslation.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbApisDestination.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbCabinclass.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbCheckinDenied.hbm.xml" />
   <mapping resource="fr/cirrus/aliss/admin/hibernate/data/TbCity.hbm.xml" />
</session-factory>
</hibernate-configuration>


Many thanx to those who could give me a clue to go forward...



Hibernate version: 3.1 rc1

Name and version of the database you are using: Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 26, 2005 9:03 am 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
Code:
        <!-- Drop and then re-create schema on SessionFactory build, for testing. -->
        <property name="hbm2ddl.auto">create</property>


Try changing it from "create" to "update". I think it will work.

C ya!


Don't forget to rate if the post helped

_________________
Don't forget to rate if the post helped!


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