-->
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: problem with auto create on hsqldb
PostPosted: Sat Jul 11, 2009 4:48 pm 
Newbie

Joined: Sat Jul 11, 2009 4:44 pm
Posts: 2
Hello all,

I have this cfg file
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>
        <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
        <property name="hibernate.connection.url">jdbc:hsqldb:mem:testdb</property>
        <property name="hibernate.connection.username">sa</property>
        <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
       
        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class">thread</property>
       
        <property name="hibernate.hbm2ddl.auto">create-drop</property>
       
        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>
       
        <mapping resource="com/mamatkon/maserver/db/hibernate/hbm/Ingredients.hbm.xml"/>
        <mapping resource="com/mamatkon/maserver/db/hibernate/hbm/MeasuringUnits.hbm.xml"/>
        <mapping resource="com/mamatkon/maserver/db/hibernate/hbm/RecipeIngredients.hbm.xml"/>
        <mapping resource="com/mamatkon/maserver/db/hibernate/hbm/Recipes.hbm.xml"/>
       
    </session-factory>
</hibernate-configuration>


but when I do save on one of my objects
I get
Code:
Caused by: java.sql.SQLException: Table not found: RECIPES in statement [insert into recipes (id, title, instructions, source, servings) values (null, ?, ?, ?, ?)]


I also tried do
Code:
new SchemaExport(config).create(true, true);


but with no luck
what can I do ? I'm going nuts here !!

thanx
Eli


Top
 Profile  
 
 Post subject: Re: problem with auto create on hsqldb
PostPosted: Sat Jul 11, 2009 11:31 pm 
Beginner
Beginner

Joined: Wed Jun 17, 2009 9:03 pm
Posts: 31
Location: mumbai
<property name="hibernate.hbm2ddl.auto">create-drop</property>

With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly.

try to use

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


Top
 Profile  
 
 Post subject: Re: problem with auto create on hsqldb
PostPosted: Sun Jul 12, 2009 1:34 am 
Newbie

Joined: Sat Jul 11, 2009 4:44 pm
Posts: 2
I don't mind the scheme being dropped, its a mem db anyway,
I try to do the save on the same session (UT)
also, I have tried create AND update, nothing works :(


Top
 Profile  
 
 Post subject: Re: problem with auto create on hsqldb
PostPosted: Sun Jul 12, 2009 3:22 am 
Beginner
Beginner

Joined: Wed Jun 17, 2009 9:03 pm
Posts: 31
Location: mumbai
Check in the database if the recipes table is getting created at the startup. Please post your mapping file and code where you are inserting the recipes in database.


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.