I am trying to run the example in the Reference Document. But I am getting error in SchemaExport. Please help me with the same. Find below the Stack trace
compile:
[javac] Compiling 3 source files to C:\Sampada\NewHibernateProject\bin
run:
[java] arg is store n b4 creation
[java] createAndStoreEvent
[java] 14:31:20,700 INFO Environment:479 - Hibernate 3.1.3
[java] 14:31:20,716 INFO Environment:509 - hibernate.properties not found
[java] 14:31:20,716 INFO Environment:525 - using CGLIB reflection optimize
r
[java] 14:31:20,716 INFO Environment:555 - using JDK 1.4 java.sql.Timestam
p handling
[java] 14:31:20,793 INFO Configuration:1308 - configuring from resource: /
hibernate.cfg.xml
[java] 14:31:20,793 INFO Configuration:1285 - Configuration resource: /hib
ernate.cfg.xml
[java] 14:31:21,136 INFO Configuration:469 - Reading mappings from resourc
e: events/Event.hbm.xml
[java] 14:31:21,277 INFO HbmBinder:309 - Mapping class: events.Event -> EV
ENTS
[java] 14:31:21,308 INFO Configuration:1419 - Configured SessionFactory: n
ull
[java] 14:31:21,386 INFO DriverManagerConnectionProvider:41 - Using Hibern
ate built-in connection pool (not for production use!)
[java] 14:31:21,386 INFO DriverManagerConnectionProvider:42 - Hibernate co
nnection pool size: 1
[java] 14:31:21,386 INFO DriverManagerConnectionProvider:45 - autocommit m
ode: false
[java] 14:31:21,401 INFO DriverManagerConnectionProvider:80 - using driver
: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql://localhost
[java] 14:31:21,401 INFO DriverManagerConnectionProvider:86 - connection p
roperties: {user=sa, password=****}
[java] 14:31:21,479 INFO SettingsFactory:77 - RDBMS: HSQL Database Engine,
version: 1.7.1
[java] 14:31:21,479 INFO SettingsFactory:78 - JDBC driver: HSQL Database E
ngine Driver, version: 1.7.1
[java] 14:31:21,510 INFO Dialect:103 - Using dialect: org.hibernate.dialec
t.HSQLDialect
[java] 14:31:21,526 INFO TransactionFactoryFactory:31 - Using default tran
saction strategy (direct JDBC transactions)
[java] 14:31:21,542 INFO TransactionManagerLookupFactory:33 - No Transacti
onManagerLookup configured (in JTA environment, use of read-write or transaction
al second-level cache is not recommended)
[java] 14:31:21,542 INFO SettingsFactory:125 - Automatic flush during befo
reCompletion(): disabled
[java] 14:31:21,542 INFO SettingsFactory:129 - Automatic session close at
end of transaction: disabled
[java] 14:31:21,542 INFO SettingsFactory:144 - Scrollable result sets: ena
bled
[java] 14:31:21,542 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
isabled
[java] 14:31:21,542 INFO SettingsFactory:160 - Connection release mode: au
to
[java] 14:31:21,542 INFO SettingsFactory:187 - Default batch fetch size: 1
[java] 14:31:21,542 INFO SettingsFactory:191 - Generate SQL with comments:
disabled
[java] 14:31:21,542 INFO SettingsFactory:195 - Order SQL updates by primar
y key: disabled
[java] 14:31:21,557 INFO SettingsFactory:338 - Query translator: org.hiber
nate.hql.ast.ASTQueryTranslatorFactory
[java] 14:31:21,557 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTran
slatorFactory
[java] 14:31:21,557 INFO SettingsFactory:203 - Query language substitution
s: {}
[java] 14:31:21,557 INFO SettingsFactory:209 - Second-level cache: enabled
[java] 14:31:21,557 INFO SettingsFactory:213 - Query cache: disabled
[java] 14:31:21,557 INFO SettingsFactory:325 - Cache provider: org.hiberna
te.cache.NoCacheProvider
[java] 14:31:21,557 INFO SettingsFactory:228 - Optimize cache for minimal
puts: disabled
[java] 14:31:21,557 INFO SettingsFactory:237 - Structured second-level cac
he entries: disabled
[java] 14:31:21,573 INFO SettingsFactory:257 - Echoing all SQL to stdout
[java] 14:31:21,573 INFO SettingsFactory:264 - Statistics: disabled
[java] 14:31:21,573 INFO SettingsFactory:268 - Deleted entity synthetic id
entifier rollback: disabled
[java] 14:31:21,573 INFO SettingsFactory:283 - Default entity-mode: pojo
[java] 14:31:21,604 INFO SessionFactoryImpl:154 - building session factory
[java] 14:31:21,994 INFO SessionFactoryObjectFactory:82 - Not binding fact
ory to JNDI, no JNDI name configured
[java] 14:31:21,994 INFO SchemaExport:152 - Running hbm2ddl schema export
[java] 14:31:22,009 DEBUG SchemaExport:168 - import file not found: /import
.sql
[java] 14:31:22,009 INFO SchemaExport:177 - exporting generated schema to
database
[java] 14:31:22,009 DEBUG SchemaExport:301 - drop table EVENTS if exists
[java] 14:31:22,009 DEBUG SchemaExport:301 - create table EVENTS (EVENT_ID
bigint generated by default as identity (start with 1), EVENT_DATE timestamp, TI
TLE varchar(255), primary key (EVENT_ID))
[java] 14:31:22,025 ERROR SchemaExport:272 - Unsuccessful: create table EVE
NTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE
timestamp, TITLE varchar(255), primary key (EVENT_ID))
[java] 14:31:22,025 ERROR SchemaExport:273 - Unexpected token: GENERATED in
statement [create table EVENTS (EVENT_ID bigint generated by default as identit
y (start with 1), EVENT_DATE timestamp, TITLE varchar(255), primary key (EVENT_I
D))]
[java] 14:31:22,025 INFO SchemaExport:194 - schema export complete
[java] createAndStoreEvent aft getting session
[java] createAndStoreEvent aft begin Transaction
[java] Hibernate: insert into EVENTS (EVENT_DATE, TITLE, EVENT_ID) values (
?, ?, null)
[java] 14:31:22,274 WARN JDBCExceptionReporter:71 - SQL Error: -22, SQLSta
te: S0002
[java] 14:31:22,274 ERROR JDBCExceptionReporter:72 - Table not found: EVENT
S in statement [insert into EVENTS (EVENT_DATE, TITLE, EVENT_ID) values ('2006-0
5-09 14:31:20.513', 'My Event', null)]
[java] org.hibernate.exception.SQLGrammarException: could not insert: [even
ts.Event]
[java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateCon
verter.java:67)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
tionHelper.java:43)
[java] at org.hibernate.persister.entity.AbstractEntityPersister.insert
(AbstractEntityPersister.java:1986)
[java] at org.hibernate.persister.entity.AbstractEntityPersister.insert
(AbstractEntityPersister.java:2405)
[java] at org.hibernate.action.EntityIdentityInsertAction.execute(Entit
yIdentityInsertAction.java:37)
[java] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248
)
[java] at org.hibernate.event.def.AbstractSaveEventListener.performSave
OrReplicate(AbstractSaveEventListener.java:269)
[java] at org.hibernate.event.def.AbstractSaveEventListener.performSave
(AbstractSaveEventListener.java:167)
[java] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGen
eratedId(AbstractSaveEventListener.java:101)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.save
WithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
[java] at org.hibernate.event.def.DefaultSaveEventListener.saveWithGene
ratedOrRequestedId(DefaultSaveEventListener.java:33)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.enti
tyIsTransient(DefaultSaveOrUpdateEventListener.java:175)
[java] at org.hibernate.event.def.DefaultSaveEventListener.performSaveO
rUpdate(DefaultSaveEventListener.java:27)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSa
veOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
[java] at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.hibernate.context.ThreadLocalSessionContext$TransactionPr
otectionWrapper.invoke(ThreadLocalSessionContext.java:301)
[java] at $Proxy0.save(Unknown Source)
[java] at events.EventManager.createAndStoreEvent(Unknown Source)
[java] at events.EventManager.main(Unknown Source)
[java] Caused by: java.sql.SQLException: Table not found: EVENTS in stateme
nt [insert into EVENTS (EVENT_DATE, TITLE, EVENT_ID) values ('2006-05-09 14:31:2
0.513', 'My Event', null)]
[java] at org.hsqldb.Trace.getError(Unknown Source)
[java] at org.hsqldb.Result.<init>(Unknown Source)
[java] at org.hsqldb.jdbcConnection.executeHSQL(Unknown Source)
[java] at org.hsqldb.jdbcConnection.execute(Unknown Source)
[java] at org.hsqldb.jdbcStatement.fetchResult(Unknown Source)
[java] at org.hsqldb.jdbcStatement.executeUpdate(Unknown Source)
[java] at org.hsqldb.jdbcPreparedStatement.executeUpdate(Unknown Source
)
[java] at org.hibernate.persister.entity.AbstractEntityPersister.insert
(AbstractEntityPersister.java:1976)
[java] ... 22 more
[java] Exception in thread "main"
[java] Java Result: 1
BUILD SUCCESSFUL
|