Re: in-memory database + hibernate + auto schema creation

View: New views
1 Messages — Rating Filter:   Alert me  

Re: in-memory database + hibernate + auto schema creation

by rsudh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
The sql statements being generated by hibernate indicate that it is attempting to create the tables, but no CREATE SCHEMA statement is being issued.

I'm using the latest version of the HSQLDB from their website. Also, now that I've read

http://opensource.atlassian.com/projects/hibernate/browse/HHH-1853

it appears that the issue was fixed in HSQLDialect.java in a later version of Hibernate. Looks like I need to upgrade my Hibernate libraries!

Thanks for your help.
-sud

----- Original Message ----
From: Blaine Simpson <blaine.simpson@...>
To: HSQLdb user discussions <hsqldb-user@...>
Sent: Thursday, April 17, 2008 2:50:31 PM
Subject: Re: [Hsqldb-user] in-memory database + hibernate + auto schema creation

hibernate.hbm2ddl.auto is the right setting.  The values for this
setting are somewhat non-intuitive, but see the Hibernate ref doc.

Set hibernate.show_sql to see what it is or is not doing.  If the schema
creation or population is attempted but fails, an exception should be
thrown.  Make sure you're not silently disgarding any RuntimeExceptions.

I have an app (written about 18 months ago) which does what you're
attempting to do.  I just had to update the HSQLDB library from the
ancient one Hibernate was bundling, and put a fixed HSQLDialect into
place.  Both of these issues are likely to fixed in Hibernate by now.


sud wrote:

> I'm attempting to setup HSQLDB as an in-memory database for unit
> testing my application. The production environment is an Oracle
> database and the tables live within a schema. So my .hbm.cfg files
> have the schema attribute in the hibernate-mapping tag as below:
>
> <hibernate-mapping auto-import="false" schema="MY_SCHEMA">
>
> In the hibernate.properties file I have:
>
> hibernate.hbm2ddl.auto=update
>
> When I run my tests, I get the following SQLException:
>
> Caused by: java.sql.SQLException: invalid schema name: MY_SCHEMA in
> statement [insert into MY_SCHEMA.CODE_SET_TYPE (CD_SET_TYPE_DESC,
> CD_SET_TYPE_ID) values (?, ?)]
>
>
> I've tried changing the
>
> hibernate.hbm2ddl.auto=create-drop
>
> ...but I get the same exception. I'd appreciate any pointers on how I
> can get Hibernate to auto-create the schema when talking to an
> in-memory HSQLDB database.
>
> Thanks
> -sud
>

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Hsqldb-user mailing list
Hsqldb-user@...
https://lists.sourceforge.net/lists/listinfo/hsqldb-user



Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Hsqldb-user mailing list
Hsqldb-user@...
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
LightInTheBox - Buy quality products at wholesale price