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
|