Error running the spring booking example with H2 database
mbsakho Jan 26, 2009 6:54 PMI'm facing with sql error while trying to run the spring booking example with the H2 database.
I'm using seam 2.1.1 and jboss 4.3.2.
the given example works with HSQL and I need it to work with H2 database.
As I know, I just have to change the configurations that are defined in the applicationContext.xml and that concern the database.
I have changed the datasource and the entityManagerFactory beans just like below:
`
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.h2.Driver"/>
<property name="url" value="jdbc:h2:C:/developpement/H2/db/formation"/>
<property name="username" value="formation"/>
<property name="password" value="formation"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="persistenceUnitName" value="bookingDatabase"/>
<!-- Use alternate location to prevent JBoss AS from automatically loading persistence units (in-container) -->
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence-spring.xml"/>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
</property>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true"/>
</bean>
</property>
<property name="jpaProperties">
<map>
<entry key="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<entry key="hibernate.format_sql" value="true"/>
<entry key="hibernate.hbm2ddl.auto" value="none"/>
</map>
</property>
</bean>
`
When I try to access the application afer deployment, I have errors below:
"18:20:15,039 ERROR [JDBCExceptionReporter] Syntax error in SQL statement SET CREATE_BUILD[*] 76; expected AUTOCOMMIT, MVCC, IGNORECASE, PASSWORD, SALT, MODE, COMPRESS_LOB, DATABASE, COLLATION, CLUSTER, DATABASE_EVENT_LISTENER, ALLOW_LITERALS, DEFAULT_TABLE_TYPE, CREATE, _HSQLDB.DEFAULT_TABLE_TYPE_, CACHE_TYPE, FILE_LOCK, STORAGE, DB_CLOSE_ON_EXIT, ACCESS_MODE_LOG, ASSERT, ACCESS_MODE_DATA, DATABASE_EVENT_LISTENER_OBJECT, RECOVER, SCHEMA, DATESTYLE, SEARCH_PATH, SCHEMA_SEARCH_PATH, LOGSIZE; SQL statement:"
It seems like it's always expecting to ron on a HSQL database.
Can someone helps me solving this.
Meissa
I'm using seam 2.1.1 and jboss 4.3.2.
the given example works with HSQL and I need it to work with H2 database.
As I know, I just have to change the configurations that are defined in the applicationContext.xml and that concern the database.
I have changed the datasource and the entityManagerFactory beans just like below:
`
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.h2.Driver"/>
<property name="url" value="jdbc:h2:C:/developpement/H2/db/formation"/>
<property name="username" value="formation"/>
<property name="password" value="formation"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="persistenceUnitName" value="bookingDatabase"/>
<!-- Use alternate location to prevent JBoss AS from automatically loading persistence units (in-container) -->
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence-spring.xml"/>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
</property>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true"/>
</bean>
</property>
<property name="jpaProperties">
<map>
<entry key="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<entry key="hibernate.format_sql" value="true"/>
<entry key="hibernate.hbm2ddl.auto" value="none"/>
</map>
</property>
</bean>
`
When I try to access the application afer deployment, I have errors below:
"18:20:15,039 ERROR [JDBCExceptionReporter] Syntax error in SQL statement SET CREATE_BUILD[*] 76; expected AUTOCOMMIT, MVCC, IGNORECASE, PASSWORD, SALT, MODE, COMPRESS_LOB, DATABASE, COLLATION, CLUSTER, DATABASE_EVENT_LISTENER, ALLOW_LITERALS, DEFAULT_TABLE_TYPE, CREATE, _HSQLDB.DEFAULT_TABLE_TYPE_, CACHE_TYPE, FILE_LOCK, STORAGE, DB_CLOSE_ON_EXIT, ACCESS_MODE_LOG, ASSERT, ACCESS_MODE_DATA, DATABASE_EVENT_LISTENER_OBJECT, RECOVER, SCHEMA, DATESTYLE, SEARCH_PATH, SCHEMA_SEARCH_PATH, LOGSIZE; SQL statement:"
It seems like it's always expecting to ron on a HSQL database.
Can someone helps me solving this.
Meissa