-->
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.  [ 6 posts ] 
Author Message
 Post subject: hbm2ddl: Where's the db file?
PostPosted: Thu Sep 28, 2006 6:35 pm 
Newbie

Joined: Thu Sep 28, 2006 6:01 pm
Posts: 8
Location: Colorado, USA
I'm using Ant to take annotated source and generate (and export) a schema like so:
Code:
        <hibernatetool destdir=".">
            <annotationconfiguration
                propertyfile="${hibernate.props.file}"
                configurationfile="${hibernate.mapping.file}"/>
            <hbm2ddl/>
        </hibernatetool>


Where the props file looks like:
Code:
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:file:compileTimeDb
hibernate.connection.username=sa
hibernate.connection.password=


When do this against a server url, I see that the schema is properly exported and creates the tables in the server DB as I want.

I assume it's also generating properly when I specify that the DB be in "file" mode rather than "server" mode. But I can't find the DB file afterwards to inspect it. All that's left are files relating to the DB file - not the DB file itself!
Code:
compileTimeDb.lck
compileTimeDb.log
compileTimeDb.properties
compileTimeDb.script


Any ideas what's happening here?

Thanks!
Sean

By the way, here is what is shown in the console when running the <hibernatetool> task:
Code:
[hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] INFO 2006-09-28 15:45:31,664 C:annotations.Version T:main - Hibernate Annotations 3.2.0.CR2
[hibernatetool] INFO 2006-09-28 15:45:31,711 C:cfg.Environment T:main - Hibernate 3.2 cr4
[hibernatetool] INFO 2006-09-28 15:45:31,727 C:cfg.Environment T:main - hibernate.properties not found
[hibernatetool] INFO 2006-09-28 15:45:31,743 C:cfg.Environment T:main - Bytecode provider name : cglib
[hibernatetool] INFO 2006-09-28 15:45:31,743 C:cfg.Environment T:main - using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] INFO 2006-09-28 15:45:31,977 C:cfg.Configuration T:main - configuring from file: hibernate.cfg.xml
[hibernatetool] INFO 2006-09-28 15:45:32,430 C:cfg.Configuration T:main - Configured SessionFactory: null
[hibernatetool] INFO 2006-09-28 15:45:32,602 C:cfg.AnnotationBinder T:main - Binding entity from annotated class: com.pillardata.message.consim.BrickInfo
[hibernatetool] INFO 2006-09-28 15:45:32,711 C:annotations.EntityBinder T:main - Bind entity com.pillardata.message.consim.BrickInfo on table BrickInfo
[hibernatetool] INFO 2006-09-28 15:45:33,164 C:dialect.Dialect T:main - Using dialect: org.hibernate.dialect.HSQLDialect
[hibernatetool] INFO 2006-09-28 15:45:33,524 C:hbm2ddl.SchemaExport T:main - Running hbm2ddl schemaexport
[hibernatetool] INFO 2006-09-28 15:45:33,539 C:hbm2ddl.SchemaExport T:main - exporting generated schema to database
[hibernatetool] INFO 2006-09-28 15:45:33,539 C:connection.DriverManagerConnectionProvider T:main - Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] INFO 2006-09-28 15:45:33,539 C:connection.DriverManagerConnectionProvider T:main - Hibernate connection pool size: 20
[hibernatetool] INFO 2006-09-28 15:45:33,539 C:connection.DriverManagerConnectionProvider T:main - autocommit mode: false
[hibernatetool] INFO 2006-09-28 15:45:33,555 C:connection.DriverManagerConnectionProvider T:main - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:file:compileTimeDb
[hibernatetool] INFO 2006-09-28 15:45:33,555 C:connection.DriverManagerConnectionProvider T:main - connection properties: {user=sa, password=****}
[hibernatetool] create table BrickInfo (BrickInfo_brickID bigint not null, HardwareResultCode_resultCode bigint, BrickInfo_maxArrays bigint, BrickEnclosure_physStatus integer, BrickEnclosure_opStatus integer, BrickSCSIEnclosureServices_physStatus integer, BrickSCSIEnclosureServices_opStatus integer, BrickSCSIEnclosureServices_serial varbinary(255), BrickSCSIEnclosureServices_version varbinary(255), BrickSCSIEnclosureServices_model varbinary(255), primary key (BrickInfo_brickID));
[hibernatetool] create table BrickInfo_array (BrickInfo_BrickInfo_brickID bigint not null, BrickArray_opStatus integer, BrickArray_cfgStatus integer, BrickArray_olFlags integer, BrickArray_arrayType integer, BrickArray_arrayID varbinary(255), BrickArray_lun numeric, BrickArray_capacity numeric, BrickInfo_array_index integer not null, primary key (BrickInfo_BrickInfo_brickID, BrickInfo_array_index));
[hibernatetool] create table BrickInfo_disk (BrickInfo_BrickInfo_brickID bigint not null, BrickDisk_access integer, BrickDisk_physStatus integer, BrickDisk_opStatus integer, BrickDisk_capacity numeric, BrickDisk_serial varbinary(255), BrickDisk_blockSize bigint, BrickDisk_slot bigint, BrickDisk_version varbinary(255), BrickDisk_model varbinary(255), BrickInfo_disk_index integer not null, primary key (BrickInfo_BrickInfo_brickID, BrickInfo_disk_index));
[hibernatetool] create table BrickInfo_fan (BrickInfo_BrickInfo_brickID bigint not null, BrickFan_physStatus integer, BrickFan_opStatus integer, BrickFan_version varbinary(255), BrickInfo_fan_index integer not null, primary key (BrickInfo_BrickInfo_brickID, BrickInfo_fan_index));
[hibernatetool] create table BrickInfo_psu (BrickInfo_BrickInfo_brickID bigint not null, BrickPowerSupply_physStatus integer, BrickPowerSupply_opStatus integer, BrickPowerSupply_serial varbinary(255), BrickPowerSupply_version varbinary(255), BrickPowerSupply_model varbinary(255), BrickInfo_psu_index integer not null, primary key (BrickInfo_BrickInfo_brickID, BrickInfo_psu_index));
[hibernatetool] create table BrickInfo_raidCtlr (BrickInfo_BrickInfo_brickID bigint not null, BrickRaidController_physStatus integer, BrickRaidController_opStatus integer, BrickInfo_raidCtlr_index integer not null, primary key (BrickInfo_BrickInfo_brickID, BrickInfo_raidCtlr_index));
[hibernatetool] create table BrickInfo_temp (BrickInfo_BrickInfo_brickID bigint not null, BrickTemperature_physStatus integer, BrickTemperature_opStatus integer, BrickInfo_temp_index integer not null, primary key (BrickInfo_BrickInfo_brickID, BrickInfo_temp_index));
[hibernatetool] alter table BrickInfo_array add constraint FK21E9DE89C2B5B746 foreign key (BrickInfo_BrickInfo_brickID) references BrickInfo;
[hibernatetool] alter table BrickInfo_disk add constraint FK95B5B6DC2B5B746 foreign key (BrickInfo_BrickInfo_brickID) references BrickInfo;
[hibernatetool] alter table BrickInfo_fan add constraint FK7C2C4343C2B5B746 foreign key (BrickInfo_BrickInfo_brickID) references BrickInfo;
[hibernatetool] alter table BrickInfo_psu add constraint FK7C2C6B02C2B5B746 foreign key (BrickInfo_BrickInfo_brickID) references BrickInfo;
[hibernatetool] alter table BrickInfo_raidCtlr add constraint FKE2019231C2B5B746 foreign key (BrickInfo_BrickInfo_brickID) references BrickInfo;
[hibernatetool] alter table BrickInfo_temp add constraint FK96291A4C2B5B746 foreign key (BrickInfo_BrickInfo_brickID) references BrickInfo;
[hibernatetool] INFO 2006-09-28 15:45:34,086 C:hbm2ddl.SchemaExport T:main - schema export complete
[hibernatetool] INFO 2006-09-28 15:45:34,133 C:connection.DriverManagerConnectionProvider T:main - cleaning up connection pool: jdbc:hsqldb:file:compileTimeDb


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 6:56 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Quote:
compileTimeDb.log


This _IS_ the database file.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 9:53 pm 
Newbie

Joined: Thu Sep 28, 2006 6:01 pm
Posts: 8
Location: Colorado, USA
Thank you, Christian.

So that means I'm asking the wrong question. I guess the question should be: Why does running this Ant target against an HQLDB server properly create all the tables I expect, but when when doing exactly the same thing - except changing the url-type to "file" - does the DB file only contain the single line:
Code:
CREATE USER SA PASSWORD "" ADMIN

It's missing all the guts that create the tables.

If (at the same time I run the "failing" DB file generation that produces the above) I also capture the schema output via:
Code:
<hbm2ddl outputfilename="output.ddl" format="true"/>

output.dll contains:
Code:
    create table BrickInfo (
        BrickInfo_brickID bigint not null,
        HardwareResultCode_resultCode bigint,
        BrickInfo_maxArrays bigint,
        BrickEnclosure_physStatus integer,
        BrickEnclosure_opStatus integer,
        BrickSCSIEnclosureServices_physStatus integer,
        BrickSCSIEnclosureServices_opStatus integer,
        BrickSCSIEnclosureServices_serial varbinary(255),
        BrickSCSIEnclosureServices_version varbinary(255),
        BrickSCSIEnclosureServices_model varbinary(255),
        primary key (BrickInfo_brickID)
    );

    create table BrickInfo_array (
        BrickInfo_BrickInfo_brickID bigint not null,
        BrickArray_opStatus integer,
        BrickArray_cfgStatus integer,
        BrickArray_olFlags integer,
        BrickArray_arrayType integer,
        BrickArray_arrayID varbinary(255),
        BrickArray_lun numeric,
        BrickArray_capacity numeric,
        BrickInfo_array_index integer not null,
        primary key (BrickInfo_BrickInfo_brickID, BrickInfo_array_index)
    );

    create table BrickInfo_disk (
        BrickInfo_BrickInfo_brickID bigint not null,
        BrickDisk_access integer,
        BrickDisk_physStatus integer,
        BrickDisk_opStatus integer,
        BrickDisk_capacity numeric,
        BrickDisk_serial varbinary(255),
        BrickDisk_blockSize bigint,
        BrickDisk_slot bigint,
        BrickDisk_version varbinary(255),
        BrickDisk_model varbinary(255),
        BrickInfo_disk_index integer not null,
        primary key (BrickInfo_BrickInfo_brickID, BrickInfo_disk_index)
    );

    create table BrickInfo_fan (
        BrickInfo_BrickInfo_brickID bigint not null,
        BrickFan_physStatus integer,
        BrickFan_opStatus integer,
        BrickFan_version varbinary(255),
        BrickInfo_fan_index integer not null,
        primary key (BrickInfo_BrickInfo_brickID, BrickInfo_fan_index)
    );

    create table BrickInfo_psu (
        BrickInfo_BrickInfo_brickID bigint not null,
        BrickPowerSupply_physStatus integer,
        BrickPowerSupply_opStatus integer,
        BrickPowerSupply_serial varbinary(255),
        BrickPowerSupply_version varbinary(255),
        BrickPowerSupply_model varbinary(255),
        BrickInfo_psu_index integer not null,
        primary key (BrickInfo_BrickInfo_brickID, BrickInfo_psu_index)
    );

    create table BrickInfo_raidCtlr (
        BrickInfo_BrickInfo_brickID bigint not null,
        BrickRaidController_physStatus integer,
        BrickRaidController_opStatus integer,
        BrickInfo_raidCtlr_index integer not null,
        primary key (BrickInfo_BrickInfo_brickID, BrickInfo_raidCtlr_index)
    );

    create table BrickInfo_temp (
        BrickInfo_BrickInfo_brickID bigint not null,
        BrickTemperature_physStatus integer,
        BrickTemperature_opStatus integer,
        BrickInfo_temp_index integer not null,
        primary key (BrickInfo_BrickInfo_brickID, BrickInfo_temp_index)
    );

    alter table BrickInfo_array
        add constraint FK21E9DE89C2B5B746
        foreign key (BrickInfo_BrickInfo_brickID)
        references BrickInfo;

    alter table BrickInfo_disk
        add constraint FK95B5B6DC2B5B746
        foreign key (BrickInfo_BrickInfo_brickID)
        references BrickInfo;

    alter table BrickInfo_fan
        add constraint FK7C2C4343C2B5B746
        foreign key (BrickInfo_BrickInfo_brickID)
        references BrickInfo;

    alter table BrickInfo_psu
        add constraint FK7C2C6B02C2B5B746
        foreign key (BrickInfo_BrickInfo_brickID)
        references BrickInfo;

    alter table BrickInfo_raidCtlr
        add constraint FKE2019231C2B5B746
        foreign key (BrickInfo_BrickInfo_brickID)
        references BrickInfo;

    alter table BrickInfo_temp
        add constraint FK96291A4C2B5B746
        foreign key (BrickInfo_BrickInfo_brickID)
        references BrickInfo;

For some reason, the compileTimeDb.log file is not getting populated. Any thoughts?

Thanks!
Sean


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 3:06 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I don't know, I really don't like HSQL DB in file mode. It's always problematic. Behavior changes between releases. That's why even the most trivial Hello World Hibernate examples use server mode.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 3:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
search for HSQL and the shutdown property

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 10:44 am 
Newbie

Joined: Thu Sep 28, 2006 6:01 pm
Posts: 8
Location: Colorado, USA
Thanks, Christian and Max.

Based on your advice I found that I needed to add:
Code:
hibernate.connection.shutdown=true

In the process of Googling, I was also directed right back to this forum to another thread on the same topic: http://forum.hibernate.org/viewtopic.php?t=940532&sid=d2b5fdb069a0c574dbfd802727f568e5


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