-->
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.  [ 3 posts ] 
Author Message
 Post subject: [Newbie] Tabelle(n) werden nicht erstellt...
PostPosted: Wed Dec 14, 2005 5:12 pm 
Newbie

Joined: Wed Dec 14, 2005 4:38 pm
Posts: 4
org.hibernate.exception.SQLGrammarException: could not retrieve snapshot
Tabelle existiert nicht

weiss nicht weiter, ich bekomme die Fehlermeldung, dass die Tabelle nicht existiert, dabei soll die doch Hibernate über das Mappimg anlegen.
Irgendwann hats mal durch Zufall funktioniert (inzwischen 2Mal durch rumspielen aber eigentlich ohne was zu ändern), keine Ahnung warum und wieso und verstehen tu ich nun gar nichts mehr.
Aber sobald ich dann wieder einen neuen Datenbanknamen angebe (DB existiert) will es wieder nicht mehr mit o.g. und folgender Begründung:

Vielleicht wisst ihr weiter
Gruß Locke

Hibernate version: 3.1

Mapping documents:
hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql:///db</property>
<property name="hibernate.connection.username">Locke</property>
<property name="hibernate.connection.username">Skorpion</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<mapping resource="fussball/Spiel.hbm.xml"/>
</session-factory>
</hibernate-configuration>

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

Full stack trace of any exception that occurs:

SCHWERWIEGEND: Tabelle 'db.spiele' existiert nicht
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not retrieve snapshot: [fussball.Spiel#0]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.getDatabaseSnapshot(AbstractEntityPersister.java:1007)
at org.hibernate.engine.StatefulPersistenceContext.getDatabaseSnapshot(StatefulPersistenceContext.java:304)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:189)
at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:459)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:84)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:502)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:496)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:492)
at fussball.FC.spielAnlegen(FC.java:32)
at fussball.Main.main(Main.java:20)
Caused by: java.sql.SQLException: Tabelle 'db.spiele' existiert nicht
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
at org.hibernate.persister.entity.AbstractEntityPersister.getDatabaseSnapshot(AbstractEntityPersister.java:982)
... 10 more


Name and version of the database you are using:

MySQL 3.23


The generated SQL (show_sql=true):

Hibernate: select spiel_.spielID, spiel_.ort as ort0_, spiel_.titel as titel0_, spiel_.spieldatum as spieldatum0_ from spiele spiel_ where spiel_.spielID=?


Debug level Hibernate log excerpt:

14.12.2005 21:49:06 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.1 rc3
14.12.2005 21:49:06 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
14.12.2005 21:49:06 org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
14.12.2005 21:49:06 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
14.12.2005 21:49:06 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: fussball/hibernate.cfg.xml
14.12.2005 21:49:06 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: fussball/hibernate.cfg.xml
14.12.2005 21:49:06 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource: fussball/Spiel.hbm.xml
14.12.2005 21:49:07 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: fussball.Spiel -> spiele
:
:
14.12.2005 21:51:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
14.12.2005 21:51:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
14.12.2005 21:51:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
14.12.2005 21:51:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///db
14.12.2005 21:51:59 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=Locke_, password=****}
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 3.23.51-nt
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.12 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )
14.12.2005 21:51:59 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
14.12.2005 21:51:59 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
14.12.2005 21:51:59 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
14.12.2005 21:51:59 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
14.12.2005 21:51:59 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: POJO
14.12.2005 21:52:00 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
14.12.2005 21:52:00 net.sf.ehcache.config.Configurator configure
WARNUNG: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/Programme/Eclipse/hibernate-3.1/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
14.12.2005 21:52:00 org.hibernate.tuple.PojoInstantiator <init>
INFO: no default (no-argument) constructor for class: fussball.Spiel (class must be instantiated by Interceptor)
Hibernate: select spiel_.spielID, spiel_.ort as ort0_, spiel_.titel as titel0_, spiel_.spieldatum as spieldatum0_ from spiele spiel_ where spiel_.spielID=?
14.12.2005 21:52:01 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
14.12.2005 21:52:01 org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 0 named HQL queries
14.12.2005 21:52:01 org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 0 named SQL queries
14.12.2005 21:52:01 org.hibernate.util.JDBCExceptionReporter logExceptions
WARNUNG: SQL Error: 1146, SQLState: 42S02
14.12.2005 21:52:01 org.hibernate.util.JDBCExceptionReporter logExceptions
SCHWERWIEGEND: Tabelle 'db.spiele' existiert nicht


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 6:27 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
<property name="hbm2ddl.auto">create</property>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 6:43 pm 
Newbie

Joined: Wed Dec 14, 2005 4:38 pm
Posts: 4
Ups, das wars schon...
dann muss ich das wohl mal ausprobiert und wieder rausgelöscht haben.

Super danke, jetzt funktionierts auf jeden Fall! *freu* ENDLICH

Vielen dank
Gruß Locke


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