-->
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: Problem with tutorial - property hbm2ddl.auto
PostPosted: Mon Jul 25, 2005 7:46 pm 
Newbie

Joined: Mon Jul 25, 2005 7:27 pm
Posts: 2
Hi there! when working through the tutorial
http://www.hibernate.org/hib_docs/v3/re ... orial.html
I get to the part where you need to disable the hbm2ddl.auto switch to prevent recreation of the database on each run, some some events can be stored.
After removing the hbm2ddl.auto property from hibernate.cfg.xml I get the following error when running ant run -Daction=store:
[java] 09:38:56,602 WARN JDBCExceptionReporter:71 - SQL Error: -22, SQLState: S0002
[java] 09:38:56,602 ERROR JDBCExceptionReporter:72 - Table not found in statement [select max(EVENT_ID) from EVENTS]

if anyone can shed some light on this for a hibernate newbie that would be great.
thanks.

$ ant run -Daction=store
cygpath: can't convert empty path
Buildfile: build.xml

clean:
[delete] Deleting directory C:\hibernate-3.0.5\devl\bin
[mkdir] Created dir: C:\hibernate-3.0.5\devl\bin

copy-resources:
[copy] Copying 3 files to C:\hibernate-3.0.5\devl\bin

compile:
[javac] Compiling 3 source files to C:\hibernate-3.0.5\devl\bin

run:
[java] 09:38:54,711 INFO Environment:464 - Hibernate 3.0.5
[java] 09:38:54,711 INFO Environment:477 - hibernate.properties not found
[java] 09:38:54,711 INFO Environment:510 - using CGLIB reflection optimize
r
[java] 09:38:54,727 INFO Environment:540 - using JDK 1.4 java.sql.Timestam
p handling
[java] 09:38:54,805 INFO Configuration:1110 - configuring from resource: /
hibernate.cfg.xml
[java] 09:38:54,805 INFO Configuration:1081 - Configuration resource: /hib
ernate.cfg.xml
[java] 09:38:55,196 INFO Configuration:444 - Mapping resource: Event.hbm.x
ml
[java] 09:38:55,352 INFO HbmBinder:260 - Mapping class: Event -> EVENTS
[java] 09:38:55,383 INFO Configuration:1222 - Configured SessionFactory: n
ull
[java] 09:38:55,399 INFO Configuration:875 - processing extends queue
[java] 09:38:55,399 INFO Configuration:879 - processing collection mapping
s
[java] 09:38:55,399 INFO Configuration:888 - processing association proper
ty references
[java] 09:38:55,399 INFO Configuration:917 - processing foreign key constr
aints
[java] 09:38:55,477 INFO DriverManagerConnectionProvider:41 - Using Hibern
ate built-in connection pool (not for production use!)
[java] 09:38:55,477 INFO DriverManagerConnectionProvider:42 - Hibernate co
nnection pool size: 1
[java] 09:38:55,477 INFO DriverManagerConnectionProvider:45 - autocommit m
ode: false
[java] 09:38:55,477 INFO DriverManagerConnectionProvider:80 - using driver
: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:data/tutorial
[java] 09:38:55,477 INFO DriverManagerConnectionProvider:86 - connection p
roperties: {user=sa, password=****}
[java] 09:38:55,930 INFO SettingsFactory:77 - RDBMS: HSQL Database Engine,
version: 1.8.0
[java] 09:38:55,930 INFO SettingsFactory:78 - JDBC driver: HSQL Database E
ngine Driver, version: 1.8.0
[java] 09:38:55,946 INFO Dialect:92 - Using dialect: org.hibernate.dialect
.HSQLDialect
[java] 09:38:55,961 INFO TransactionFactoryFactory:31 - Using default tran
saction strategy (direct JDBC transactions)
[java] 09:38:55,961 INFO TransactionManagerLookupFactory:33 - No Transacti
onManagerLookup configured (in JTA environment, use of read-write or transaction
al second-level cache is not recommended)
[java] 09:38:55,961 INFO SettingsFactory:125 - Automatic flush during befo
reCompletion(): disabled
[java] 09:38:55,961 INFO SettingsFactory:129 - Automatic session close at
end of transaction: disabled
[java] 09:38:55,961 INFO SettingsFactory:136 - JDBC batch size: 15
[java] 09:38:55,961 INFO SettingsFactory:139 - JDBC batch updates for vers
ioned data: disabled
[java] 09:38:55,977 INFO SettingsFactory:144 - Scrollable result sets: ena
bled
[java] 09:38:55,977 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
isabled
[java] 09:38:55,977 INFO SettingsFactory:160 - Connection release mode: nu
ll
[java] 09:38:55,977 INFO SettingsFactory:187 - Default batch fetch size: 1

[java] 09:38:55,977 INFO SettingsFactory:191 - Generate SQL with comments:
disabled
[java] 09:38:55,977 INFO SettingsFactory:195 - Order SQL updates by primar
y key: disabled
[java] 09:38:55,977 INFO SettingsFactory:334 - Query translator: org.hiber
nate.hql.ast.ASTQueryTranslatorFactory
[java] 09:38:55,977 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTran
slatorFactory
[java] 09:38:55,977 INFO SettingsFactory:203 - Query language substitution
s: {}
[java] 09:38:55,977 INFO SettingsFactory:209 - Second-level cache: enabled

[java] 09:38:55,977 INFO SettingsFactory:213 - Query cache: disabled
[java] 09:38:55,977 INFO SettingsFactory:321 - Cache provider: org.hiberna
te.cache.EhCacheProvider
[java] 09:38:55,993 INFO SettingsFactory:228 - Optimize cache for minimal
puts: disabled
[java] 09:38:56,008 INFO SettingsFactory:237 - Structured second-level cac
he entries: disabled
[java] 09:38:56,008 INFO SettingsFactory:257 - Echoing all SQL to stdout
[java] 09:38:56,008 INFO SettingsFactory:261 - Statistics: disabled
[java] 09:38:56,008 INFO SettingsFactory:265 - Deleted entity synthetic id
entifier rollback: disabled
[java] 09:38:56,008 INFO SettingsFactory:279 - Default entity-mode: pojo
[java] 09:38:56,149 INFO SessionFactoryImpl:152 - building session factory

[java] 09:38:56,165 WARN Configurator:126 - No configuration found. Config
uring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/hib
ernate-3.0.5/devl/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
[java] 09:38:56,540 INFO SessionFactoryObjectFactory:82 - Not binding fact
ory to JNDI, no JNDI name configured
[java] 09:38:56,540 INFO SessionFactoryImpl:379 - Checking 0 named queries

[java] 09:38:56,602 WARN JDBCExceptionReporter:71 - SQL Error: -22, SQLSta
te: S0002
[java] 09:38:56,602 ERROR JDBCExceptionReporter:72 - Table not found in sta
tement [select max(EVENT_ID) from EVENTS]
[java] org.hibernate.exception.SQLGrammarException: could not fetch initial
value
[java] at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeC
onverter.java:70)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
tionHelper.java:43)
[java] at org.hibernate.id.IncrementGenerator.getNext(IncrementGenerato
r.java:107)
[java] at org.hibernate.id.IncrementGenerator.generate(IncrementGenerat
or.java:45)
[java] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGen
eratedId(AbstractSaveEventListener.java:85)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.save
WithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
[java] at org.hibernate.event.def.DefaultSaveEventListener.saveWithGene
ratedOrRequestedId(DefaultSaveEventListener.java:33)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.enti
tyIsTransient(DefaultSaveOrUpdateEventListener.java:173)
[java] at org.hibernate.event.def.DefaultSaveEventListener.performSaveO
rUpdate(DefaultSaveEventListener.java:27)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSa
veOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
[java] at EventManager.createAndStoreEvent(Unknown Source)
[java] at EventManager.main(Unknown Source)
[java] Caused by: java.sql.SQLException: Table not found in statement [sele
ct max(EVENT_ID) from EVENTS]
[java] at org.hsqldb.jdbc.Util.throwError(Unknown Source)
[java] at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
[java] at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Sourc
e)
[java] at org.hibernate.id.IncrementGenerator.getNext(IncrementGenerato
r.java:86)
[java] ... 11 more
[java] Exception in thread "main"
[java] Java Result: 1

BUILD SUCCESSFUL
Total time: 4 seconds

Hibernate version: 3.0.5

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 25, 2005 9:05 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
OK, I'll rewrite that whole section. I don't know what you guys are doing, but in my tests what I describe works fine. First I run a "store" with hbm2ddl.auto enabled, then I disable it and run a "store" or a "list". This seems to be a major issue.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 12:21 am 
Newbie

Joined: Mon Jul 25, 2005 7:27 pm
Posts: 2
got the example working using MySQL instead, will move forward from here. thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 16, 2005 12:58 am 
Newbie

Joined: Fri Sep 16, 2005 12:52 am
Posts: 1
christian wrote:
OK, I'll rewrite that whole section. I don't know what you guys are doing, but in my tests what I describe works fine. First I run a "store" with hbm2ddl.auto enabled, then I disable it and run a "store" or a "list". This seems to be a major issue.


If you're using hsqldb 1.8.0, what you describe above only works (for me at least) if you add

<property name="connection.shutdown">true</property>

to hibernate.cfg.xml. Otherwise I see the same problem.

-brunk


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 14, 2005 4:07 pm 
Newbie

Joined: Fri Oct 14, 2005 4:02 pm
Posts: 1
Location: South Carolina, USA
brunk wrote:
If you're using hsqldb 1.8.0, what you describe above only works (for me at least) if you add

<property name="connection.shutdown">true</property>

to hibernate.cfg.xml. Otherwise I see the same problem.

-brunk


Thanks, brunk. I was having the same problem with the tutorial, but this fixes it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 11:36 am 
Newbie

Joined: Tue Oct 18, 2005 11:22 am
Posts: 14
brunk wrote:
If you're using hsqldb 1.8.0, what you describe above only works (for me at least) if you add

<property name="connection.shutdown">true</property>

to hibernate.cfg.xml. Otherwise I see the same problem.

Hi there,

Is "connection.shutdown" the same property like "hibernate.connection.shutdown"?

Why is this property not mentioned in the Hibernate Reference Documentation? Are there other "unknown" properties like this? Where can I get an overview / complet list of all hibernate configuration properties?

By the way is there any other possibility to make HSQLDB write the DB-Changes from the mydb.log to mydb.script via Hibernate?

Ok, these were many questions at one time. ;-)
Thanks in advance.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.