Everything seems OK with 'create table', 'insert', 'drop table' etc. statements and commit, when I execute hibernate tutorials/samples. But nothing is written to the DB. No exceptions occur. The DB is created with lck, log, script, and properties file. Script file just has got
"CREATE SCHEMA PUBLIC AUTHORIZATION DBA
CREATE USER SA PASSWORD ""
GRANT DBA TO SA
SET WRITE_DELAY 20".
Nothing more than this. When I open the DB using
"java org.hsqldb.util.DatabaseManager -driver org.hsqldb.jdbcDriver -url jdbc:hsqldb:data/auction -user sa"
I see an empty DB, with no objects, no data inserted, no data updated etc.
Tired of executing N hibernate tutorial and sample programs.
Find below details when I tried to execute 'auction eg' of hibernate3.1. Need help very badly.
Hibernate version: hibernate-3.1
Mapping documents: AuctionItem.hbm, Bid.hbm, User.hbm
Code between sessionFactory.openSession() and session.close():
Session s = factory.openSession();
Transaction tx = s.beginTransaction();
User seller = new User();
seller.setUserName("xam");
seller.setName( new Name("Max", new Character('R'), "Andersen") );
seller.setEmail("max@hibernate.org");
seller.setPassword("******");
seller.setAuctions( new ArrayList() );
s.save(seller);
tx.commit();
s.close();
Full stack trace of any exception that occurs: NO EXCEPTION, but for
Buildfile: build.xml
[taskdef] Could not load definitions from resource checkstyletask.properties. It could not be found.
[taskdef] Could not load definitions from resource clovertasks. It could not be found.
Name and version of the database you are using: HSQLDB 1.8
The generated SQL (show_sql=true):
[java] 16:36:06,250 DEBUG SchemaExport:301 -
[java] drop table AuctionItem if exists
[java] 16:36:06,250 DEBUG SchemaExport:301 -
[java] drop table AuctionUser if exists
[java] 16:36:06,265 DEBUG SchemaExport:301 -
[java] drop table Bid if exists
[java] 16:36:06,281 DEBUG SchemaExport:301 -
[java] create table AuctionItem (
[java] id bigint generated by default as identity (start with 1),
[java] seller bigint not null,
[java] shortDescription varchar(200) not null,
[java] description varchar(1000),
[java] ends timestamp,
[java] "CONDITION" integer,
[java] successfulBid bigint,
[java] primary key (id),
[java] unique (seller, shortDescription)
[java] )
[java] 16:36:06,343 DEBUG SchemaExport:301 -
[java] create table AuctionUser (
[java] id bigint generated by default as identity (start with 1),
[java] userName varchar(10) not null,
[java] "password" varchar(15) not null,
[java] email varchar(255),
[java] firstName varchar(50) not null,
[java] "initial" char(1),
[java] lastName varchar(50) not null,
[java] primary key (id),
[java] unique (userName)
[java] )
[java] 16:36:06,390 DEBUG SchemaExport:301 -
[java] create table Bid (
[java] id bigint generated by default as identity (start with 1),
[java] isBuyNow char(1) not null,
[java] item bigint not null,
[java] amount float not null,
[java] "datetime" timestamp not null,
[java] bidder bigint not null,
[java] primary key (id),
[java] unique (item, amount)
[java] )
[java] 16:36:06,421 DEBUG SchemaExport:301 -
[java] alter table AuctionItem
[java] add constraint FK522A9BD6F65B1FAF
[java] foreign key (successfulBid)
[java] references Bid
[java] 16:36:06,437 DEBUG SchemaExport:301 -
[java] alter table AuctionItem
[java] add constraint FK522A9BD61107FE9B
[java] foreign key (seller)
[java] references AuctionUser
[java] 16:36:06,453 DEBUG SchemaExport:301 -
[java] alter table Bid
[java] add constraint FK104DDF43A3910
[java] foreign key (bidder)
[java] references AuctionUser
[java] 16:36:06,468 DEBUG SchemaExport:301 -
.....
.....
.....
[java] insert
[java] into
[java] AuctionItem
[java] (seller, shortDescription, description, ends, "CONDITION", s
cessfulBid, id)
[java] values
[java] (?, ?, ?, ?, ?, ?, null)
[java] Hibernate:
[java] call identity()
[java] Hibernate:
[java] insert
[java] into
[java] Bid
[java] (item, amount, "datetime", bidder, isBuyNow, id)
[java] values
[java] (?, ?, ?, ?, 'N', null)
[java] Hibernate:
[java] call identity()
.....
.....
....
[java] Viewing auctions containing: DESC with condition: 8/10
[java] Item: 3 - new description
[java] 16:40:36,500 INFO SessionFactoryImpl:729 - closing
[java] 16:40:36,500 INFO DriverManagerConnectionProvider:147 - cleaning up
connection pool: jdbc:hsqldb:data/auction
[echo] Please follow the Getting Started road map:
http://www.hibernate.org
/152.html
BUILD SUCCESSFUL
Total time: 4 minutes 48 seconds
Debug level Hibernate log excerpt: log4j.logger.org.hibernate=info
hibernate.properties: hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:data/auction
hibernate.connection.username=sa
hibernate.connection.password=