I use Hibernate + SQLite and i need to support updating database schema when:
- a) table is added
- b) table is removed
- c) columnd is added
- d) column is removed
My hibernate configuration:
Code:
lConf.setProperty("hibernate.dialect", "app.sqlite.SQLiteDialect");
lConf.setProperty("hibernate.connection.driver_class", "org.sqlite.JDBC");
lConf.setProperty("hibernate.hbm2ddl.auto", "update");
I can paste here SQLiteDialect if needed.
My database is not updated when new database entity is added and i the exception occures:
Code:
Caused by: java.util.NoSuchElementException
at java.util.StringTokenizer.nextToken(Unknown Source)
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.getColumn(InformationExtractorJdbcDatabaseMetaDataImpl.java:469)
at org.hibernate.tool.schema.extract.internal.TableInformationImpl.getColumn(TableInformationImpl.java:68)
at org.hibernate.mapping.Table.sqlAlterStrings(Table.java:456)
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.migrateTable(SchemaMigratorImpl.java:254)
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigrationToTargets(SchemaMigratorImpl.java:170)
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:60)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:133)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:101)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:470)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
at app.sqlite.eDocumentsDBConnector.connect(eDocumentsDBConnector.java:69)