This is the hsql.properties that was generated:
#HSQL Database Engine 1.8.0.5
#Sat Apr 26 07:57:59 PDT 2008
hsqldb.script_format=0
runtime.gc_interval=0
sql.enforce_strict_size=false
hsqldb.cache_size_scale=8
readonly=false
hsqldb.nio_data_file=true
hsqldb.cache_scale=14
version=1.8.0
hsqldb.default_table_type=memory
hsqldb.cache_file_scale=1
hsqldb.log_size=200
modified=no
hsqldb.cache_version=1.7.0
hsqldb.original_version=1.8.0
hsqldb.compatible_version=1.8.0
And here is the hsql.script that is generated:
CREATE SCHEMA PUBLIC AUTHORIZATION DBA
CREATE MEMORY TABLE ADDRESS(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START
WITH 1) NOT NULL PRIMARY KEY,VERSION INTEGER,ADDRESS VARCHAR(25) NOT
NULL,CITY VARCHAR(25) NOT NULL,COUNTRY VARCHAR(2) NOT NULL,POSTAL_CODE
VARCHAR(25) NOT NULL,PROVINCE VARCHAR(25) NOT NULL)
CREATE MEMORY TABLE APP_USER(ID BIGINT GENERATED BY DEFAULT AS
IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,VERSION INTEGER,CONFIRMPASSWORD
VARCHAR(255),EMAIL VARCHAR(50) NOT NULL,FIRST_NAME VARCHAR(50) NOT
NULL,LAST_NAME VARCHAR(50) NOT NULL,MIDDLE_NAME VARCHAR(50),PASSWORD
VARCHAR(100) NOT NULL,PASSWORD_HINT VARCHAR(50),PHONE_NUMBER
VARCHAR(25),USERNAME VARCHAR(25) NOT NULL,WEBSITE VARCHAR(50),ADDRESS_FK
BIGINT,CONSTRAINT FK459C57294AD68248 FOREIGN KEY(ADDRESS_FK) REFERENCES
ADDRESS(ID))
CREATE MEMORY TABLE ROLE(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START
WITH 1) NOT NULL PRIMARY KEY,VERSION INTEGER,DESCRIPTION VARCHAR(255) NOT
NULL,NAME VARCHAR(64) NOT NULL)
CREATE MEMORY TABLE USER_ROLE(USER_ID BIGINT NOT NULL,ROLE_ID BIGINT NOT
NULL,PRIMARY KEY(USER_ID,ROLE_ID),CONSTRAINT FK143BF46AE8EA6EF6 FOREIGN
KEY(USER_ID) REFERENCES APP_USER(ID),CONSTRAINT FK143BF46A43BFAB16 FOREIGN
KEY(ROLE_ID) REFERENCES ROLE(ID))
ALTER TABLE ADDRESS ALTER COLUMN ID RESTART WITH 1
ALTER TABLE APP_USER ALTER COLUMN ID RESTART WITH 1
ALTER TABLE ROLE ALTER COLUMN ID RESTART WITH 1
CREATE USER SA PASSWORD ""
GRANT DBA TO SA
SET WRITE_DELAY 10
On Sat, Apr 26, 2008 at 7:11 AM, Mick Knutson <[EMAIL PROTECTED]> wrote:
> zI am trying to run hibernate to generate sql, populate my db and then run
> some tests.
> Well, if I use MySql, I do not have any issues at all. But when I switch
> to hsql, i can't get the databasse tables to be created, then I get a table
> not exist error in dbunit.
>
> Here is my hibernate plugin:
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>hibernate3-maven-plugin</artifactId>
> <version>2.1</version>
> <configuration>
> <components>
> <component>
> <name>hbm2ddl</name>
>
> <implementation>annotationconfiguration</implementation>
> </component>
> <component>
> <name>hbm2hbmxml</name>
>
> <outputDirectory>src/main/resources</outputDirectory>
> </component>
> </components>
> <componentProperties>
> <drop>true</drop>
>
> <configurationfile>/src/main/resources/hibernate.cfg.xml</configurationfile>
> <jdk5>true</jdk5>
> <skip>${maven.test.skip}</skip>
> </componentProperties>
> </configuration>
> <executions>
> <execution>
> <id>hbm2ddl</id>
> <phase>process-test-resources</phase>
> <goals>
> <goal>hbm2ddl</goal>
> </goals>
> </execution>
> </executions>
> <dependencies>
> <dependency>
> <groupId>${jdbc.groupId}</groupId>
> <artifactId>${jdbc.artifactId}</artifactId>
> <version>${jdbc.version}</version>
> </dependency>
> </dependencies>
> </plugin>
>
> So what am I missing? Why do the tables for Mysql but with HSQL they do
> not?
> Also, I do not see any files generated in src/main/resources/
>
> Here is the trace when I run hibernate alone:
>
> [myproject] INFO [main] SchemaExport.execute(154) | Running hbm2ddl schema
> export
> [myproject] DEBUG [main] SchemaExport.execute(170) | import file not
> found: /import.sql
> [myproject] INFO [main] SchemaExport.execute(179) | exporting generated
> schema to database
> [myproject] INFO [main] DriverManagerConnectionProvider.configure(41) |
> Using Hibernate built-in connection pool (not for production use!)
> [myproject] INFO [main] DriverManagerConnectionProvider.configure(42) |
> Hibernate connection pool size: 20
> [myproject] INFO [main] DriverManagerConnectionProvider.configure(45) |
> autocommit mode: false
> [myproject] INFO [main] DriverManagerConnectionProvider.configure(80) |
> using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:file:target/testd
> b-hsql;shutdown=true
> [myproject] INFO [main] DriverManagerConnectionProvider.configure(83) |
> connection properties: {user=sa, password=}
> [myproject] DEBUG [main] DriverManagerConnectionProvider.getConnection(93)
> | total checked-out connections: 0
> [myproject] DEBUG [main]
> DriverManagerConnectionProvider.getConnection(109) | opening new JDBC
> connection
> [myproject] DEBUG [main]
> DriverManagerConnectionProvider.getConnection(115) | created connection to:
> jdbc:hsqldb:file:target/testdb-hsql;shutdown
> =true, Isolation Level: 2
> alter table app_user drop constraint FK459C57294AD68248;
> [myproject] DEBUG [main] SchemaExport.execute(303) | alter table app_user
> drop constraint FK459C57294AD68248;
> [myproject] DEBUG [main] SchemaExport.drop(288) | Unsuccessful: alter
> table app_user drop constraint FK459C57294AD68248
> [myproject] DEBUG [main] SchemaExport.drop(289) | Table not found:
> APP_USER in statement [alter table app_user]
> alter table user_role drop constraint FK143BF46AE8EA6EF6;
> [myproject] DEBUG [main] SchemaExport.execute(303) | alter table user_role
> drop constraint FK143BF46AE8EA6EF6;
> [myproject] DEBUG [main] SchemaExport.drop(288) | Unsuccessful: alter
> table user_role drop constraint FK143BF46AE8EA6EF6
> [myproject] DEBUG [main] SchemaExport.drop(289) | Table not found:
> USER_ROLE in statement [alter table user_role]
> alter table user_role drop constraint FK143BF46A43BFAB16;
> [myproject] DEBUG [main] SchemaExport.execute(303) | alter table user_role
> drop constraint FK143BF46A43BFAB16;
> [myproject] DEBUG [main] SchemaExport.drop(288) | Unsuccessful: alter
> table user_role drop constraint FK143BF46A43BFAB16
> [myproject] DEBUG [main] SchemaExport.drop(289) | Table not found:
> USER_ROLE in statement [alter table user_role]
> drop table address if exists;
> [myproject] DEBUG [main] SchemaExport.execute(303) | drop table address if
> exists;
> drop table app_user if exists;
> [myproject] DEBUG [main] SchemaExport.execute(303) | drop table app_user
> if exists;
> drop table role if exists;
> [myproject] DEBUG [main] SchemaExport.execute(303) | drop table role if
> exists;
> drop table user_role if exists;
> [myproject] DEBUG [main] SchemaExport.execute(303) | drop table user_role
> if exists;
> create table address (id bigint generated by default as identity (start
> with 1), version integer, address varchar(25) not null, city varchar(25)
> not null, country varchar(2) not null, postal_code varchar(25) not null,
> province varchar(25) not null, primary key (id));
> [myproject] DEBUG [main] SchemaExport.execute(303) | create table address
> (id bigint generated by default as identity (start with 1), version int
> eger, address varchar(25) not null, city varchar(25) not null, country
> varchar(2) not null, postal_code varchar(25) not null, province varchar(25
> ) not null, primary key (id));
> create table app_user (id bigint generated by default as identity (start
> with 1), version integer, confirmPassword varchar(255), email varchar(50
> ) not null, first_name varchar(50) not null, last_name varchar(50) not
> null, middle_name varchar(50), password varchar(100) not null, password_hi
> nt varchar(50), phone_number varchar(25), username varchar(25) not null,
> website varchar(50), address_fk bigint, primary key (id));
> [myproject] DEBUG [main] SchemaExport.execute(303) | create table app_user
> (id bigint generated by default as identity (start with 1), version in
> teger, confirmPassword varchar(255), email varchar(50) not null,
> first_name varchar(50) not null, last_name varchar(50) not null, middle_name
> var
> char(50), password varchar(100) not null, password_hint varchar(50),
> phone_number varchar(25), username varchar(25) not null, website varchar(50)
> , address_fk bigint, primary key (id));
> create table role (id bigint generated by default as identity (start with
> 1), version integer, description varchar(255) not null, name varchar(64
> ) not null, primary key (id));
> [myproject] DEBUG [main] SchemaExport.execute(303) | create table role (id
> bigint generated by default as identity (start with 1), version intege
> r, description varchar(255) not null, name varchar(64) not null, primary
> key (id));
> create table user_role (user_id bigint not null, role_id bigint not null,
> primary key (user_id, role_id));
> [myproject] DEBUG [main] SchemaExport.execute(303) | create table
> user_role (user_id bigint not null, role_id bigint not null, primary key
> (user_
> id, role_id));
> alter table app_user add constraint FK459C57294AD68248 foreign key
> (address_fk) references address;
> [myproject] DEBUG [main] SchemaExport.execute(303) | alter table app_user
> add constraint FK459C57294AD68248 foreign key (address_fk) references a
> ddress;
> alter table user_role add constraint FK143BF46AE8EA6EF6 foreign key
> (user_id) references app_user;
> [myproject] DEBUG [main] SchemaExport.execute(303) | alter table user_role
> add constraint FK143BF46AE8EA6EF6 foreign key (user_id) references app
> _user;
> alter table user_role add constraint FK143BF46A43BFAB16 foreign key
> (role_id) references role;
> [myproject] DEBUG [main] SchemaExport.execute(303) | alter table user_role
> add constraint FK143BF46A43BFAB16 foreign key (role_id) references rol
> e;
> [myproject] INFO [main] SchemaExport.execute(196) | schema export complete
> [myproject] DEBUG [main]
> DriverManagerConnectionProvider.closeConnection(129) | returning connection
> to pool, pool size: 1
> [myproject] INFO [main] DriverManagerConnectionProvider.close(147) |
> cleaning up connection pool: jdbc:hsqldb:file:target/testdb-hsql;shutdown=tr
> ue
> [WARNING] 3 errors occurred while performing <hbm2ddl>.
> *[ERROR] Error #1: java.sql.SQLException: Table not found: APP_USER in
> statement [alter table app_user]
> [ERROR] Error #1: java.sql.SQLException: Table not found: USER_ROLE in
> statement [alter table user_role]
> [ERROR] Error #1: java.sql.SQLException: Table not found: USER_ROLE in
> statement [alter table user_role]
> [INFO]
> ------------------------------------------------------------------------*
>
>
> I would alos assume that I could point dbvisualizer at this hsql db and I
> could see the tables which I can't. It connects, but there are no tables.
>
> --
> Thanks,
> Mick Knutson
>
> http://www.baselogic.com
> http://www.blincmagazine.com
> http://www.linkedin.com/in/mickknutson
> http://www.djmick.com
> http://www.myspace.com/mickknutson
> http://www.myspace.com/BLiNCMagazine
> http://tahoe.baselogic.com
> ---
--
Thanks,
Mick Knutson
http://www.baselogic.com
http://www.blincmagazine.com
http://www.linkedin.com/in/mickknutson
http://www.djmick.com
http://www.myspace.com/mickknutson
http://www.myspace.com/BLiNCMagazine
http://tahoe.baselogic.com
---