-->
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.  [ 2 posts ] 
Author Message
 Post subject: java.sql.SQLException: Table not found
PostPosted: Fri Apr 28, 2006 12:15 pm 
Newbie

Joined: Fri Apr 28, 2006 12:07 pm
Posts: 14
Hello! I'm a new user of Hibernate and I can't fix a problem with the configuration. I'm following the steps of the reference documentation and at the time of storing I have this problem:

ant run -Daction=store
Buildfile: build.xml

clean:
[delete] Deleting directory /home/mjimenez/workspace/HibernatePrueba/bin
[mkdir] Created dir: /home/mjimenez/workspace/HibernatePrueba/bin

copy-resources:
[copy] Copying 4 files to /home/mjimenez/workspace/HibernatePrueba/bin
[copy] Copied 2 empty directories to 1 empty directory under /home/mjimenez/workspace/HibernatePrueba/bin

compile:
[javac] Compiling 3 source files to /home/mjimenez/workspace/HibernatePrueba/bin

run:
[java] 16:40:54,200 INFO Environment:479 - Hibernate 3.1.3
[java] 16:40:54,210 INFO Environment:494 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.hsqldb.jdbcDriver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, hibernate.current_session_context_class=thread, hibernate.max_fetch_depth=1, hibernate.dialect=org.hibernate.dialect.HSQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=sa, hibernate.cache.region_prefix=hibernate.test, hibernate.hbm2ddl.auto=create, hibernate.connection.url=jdbc:hsqldb:., hibernate.show_sql=true, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}
[java] 16:40:54,212 INFO Environment:524 - using java.io streams to persist binary types
[java] 16:40:54,214 INFO Environment:525 - using CGLIB reflection optimizer
[java] 16:40:54,216 INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling
[java] 16:40:54,317 INFO Configuration:1308 - configuring from resource: /hibernate.cfg.xml
[java] 16:40:54,322 INFO Configuration:1285 - Configuration resource: /hibernate.cfg.xml
[java] 16:40:54,647 INFO Configuration:469 - Reading mappings from resource: events/Event.hbm.xml
[java] 16:40:54,804 INFO HbmBinder:309 - Mapping class: events.Event -> EVENTS
[java] 16:40:54,865 INFO Configuration:1419 - Configured SessionFactory: null
[java] 16:40:54,970 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
[java] 16:40:54,970 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1
[java] 16:40:54,975 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
[java] 16:40:54,981 INFO DriverManagerConnectionProvider:80 - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql://localhost
[java] 16:40:54,982 INFO DriverManagerConnectionProvider:86 - connection properties: {user=sa, password=****}
[java] 16:40:55,044 INFO SettingsFactory:77 - RDBMS: HSQL Database Engine, version: 1.6
[java] 16:40:55,045 INFO SettingsFactory:78 - JDBC driver: HSQL Database Engine Driver, version: 1.6
[java] 16:40:55,101 INFO Dialect:103 - Using dialect: org.hibernate.dialect.HSQLDialect
[java] 16:40:55,154 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
[java] 16:40:55,157 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[java] 16:40:55,158 INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disabled
[java] 16:40:55,159 INFO SettingsFactory:129 - Automatic session close at end of transaction: disabled
[java] 16:40:55,160 INFO SettingsFactory:144 - Scrollable result sets: disabled
[java] 16:40:55,161 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): disabled
[java] 16:40:55,161 INFO SettingsFactory:160 - Connection release mode: auto
[java] 16:40:55,163 INFO SettingsFactory:184 - Maximum outer join fetch depth: 1
[java] 16:40:55,163 INFO SettingsFactory:187 - Default batch fetch size: 1
[java] 16:40:55,164 INFO SettingsFactory:191 - Generate SQL with comments: disabled
[java] 16:40:55,164 INFO SettingsFactory:195 - Order SQL updates by primary key: disabled
[java] 16:40:55,166 INFO SettingsFactory:338 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[java] 16:40:55,169 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory
[java] 16:40:55,170 INFO SettingsFactory:203 - Query language substitutions: {}
[java] 16:40:55,170 INFO SettingsFactory:209 - Second-level cache: enabled
[java] 16:40:55,172 INFO SettingsFactory:213 - Query cache: disabled
[java] 16:40:55,174 INFO SettingsFactory:325 - Cache provider: org.hibernate.cache.NoCacheProvider
[java] 16:40:55,177 INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
[java] 16:40:55,177 INFO SettingsFactory:233 - Cache region prefix: hibernate.test
[java] 16:40:55,178 INFO SettingsFactory:237 - Structured second-level cache entries: disabled
[java] 16:40:55,184 INFO SettingsFactory:257 - Echoing all SQL to stdout
[java] 16:40:55,184 INFO SettingsFactory:264 - Statistics: disabled
[java] 16:40:55,185 INFO SettingsFactory:268 - Deleted entity synthetic identifier rollback: disabled
[java] 16:40:55,185 INFO SettingsFactory:283 - Default entity-mode: pojo
[java] 16:40:55,255 INFO SessionFactoryImpl:154 - building session factory
[java] 16:40:55,613 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
[java] 16:40:55,618 INFO SchemaExport:152 - Running hbm2ddl schema export
[java] 16:40:55,621 DEBUG SchemaExport:168 - import file not found: /import.sql
[java] 16:40:55,622 INFO SchemaExport:177 - exporting generated schema to database
[java] 16:40:55,624 DEBUG SchemaExport:301 - drop table EVENTS if exists
[java] 16:40:55,626 DEBUG SchemaExport:286 - Unsuccessful: drop table EVENTS if exists
[java] 16:40:55,626 DEBUG SchemaExport:287 - Table not found: EVENTS in statement [drop table EVENTS if exists]
[java] 16:40:55,627 DEBUG SchemaExport:301 - create table EVENTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE timestamp, title varchar(255), primary key (EVENT_ID))
[java] 16:40:55,635 ERROR SchemaExport:272 - Unsuccessful: create table EVENTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE timestamp, title varchar(255), primary key (EVENT_ID))
[java] 16:40:55,637 ERROR SchemaExport:273 - Unexpected token: GENERATED in statement [create table EVENTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE timestamp, title varchar(255), primary key (EVENT_ID))]
[java] 16:40:55,638 INFO SchemaExport:194 - schema export complete
[java] 16:40:55,794 WARN EventManager:? - #############último paso dnd me imprime, a partir de aquí peta del todo
[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values (?, ?, null)
[java] 16:40:55,848 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState: S0002
[java] 16:40:55,882 ERROR JDBCExceptionReporter:72 - Table not found: EVENTS in statement [insert into EVENTS (EVENT_DATE, title, EVENT_ID) values ('2006-04-28 16:40:54.155', 'My Event', null)]
[java] Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [events.Event]
[java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.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(EntityIdentityInsertAction.java:37)
[java] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
[java] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:269)
[java] at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
[java] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
[java] at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
[java] at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(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(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.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 statement [insert into EVENTS (EVENT_DATE, title, EVENT_ID) values ('2006-04-28 16 :40:54.155', 'My Event', null)]
[java] at org.hsqldb.Trace.getError(Trace.java:180)
[java] at org.hsqldb.Result.<init>(Result.java:175)
[java] at org.hsqldb.jdbcConnection.executeHSQL(jdbcConnection.java:907)
[java] at org.hsqldb.jdbcConnection.execute(jdbcConnection.java:718)
[java] at org.hsqldb.jdbcStatement.fetchResult(jdbcStatement.java:686)
[java] at org.hsqldb.jdbcStatement.executeUpdate(jdbcStatement.java:85)
[java] at org.hsqldb.jdbcPreparedStatement.executeUpdate(jdbcPreparedStatement.java:152)
[java] at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1976)
[java] ... 22 more
[java] Java Result: 1

BUILD SUCCESSFUL
Total time: 3 seconds



Which is my problem? Thank you very much for your time


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 2:33 pm 
Regular
Regular

Joined: Wed Feb 22, 2006 11:28 am
Posts: 65
Location: Santiago, Chile
See in detail you hibernate mapping files for the Class Event.

Because, in order to ur exception trace, it sayed:
Unexpected token: GENERATED in statement [create table EVENTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE timestamp, title varchar(255), primary key (EVENT_ID))]

I think, that is your main problem.

Requests for comments


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