hsqldb

HSQL + Hibernate Exception: Wrong column type: Found: double, expected: float

放肆的年华 提交于 2019-11-28 14:11:48
I am using in-memory HSQL (HSQLDB) with Hibernate for all my unit tests, because it is very fast. I have a table with a column defined as follows: float qw; When hibernate starts, I get the following error: org.hibernate.HibernateException: Wrong column type in MyTable for column qw. Found: double, expected: float Why does it find double when the column is declared as float ? Mike Nakis This is happening due to a series of unfortunate events . The problem begins with the fact that HSQLDB does not support the float data type. (Duh? Yes, I know, but Documentation here .) The problem starts

how to return last inserted (auto incremented) row id in HSQL?

旧街凉风 提交于 2019-11-28 13:47:18
i am working with HSQL database for testing purpose. i want standalone db file. but now i am in trouble to get last inserted row id (auto-incremental - identity) in HSQL. how can i get id?? It's pretty hard to write a query to perform this when you haven't given your table schema, but something like the following: SELECT TOP 1 Id FROM [TABLENAME] ORDER BY Id DESC http://www.hsqldb.org/doc/guide/ch09.html the last inserted value into an identity column for a connection is available using the function IDENTITY(), for example (where Id is the identity column): INSERT INTO Test (Id, Name) VALUES

SQL - Add up all row-values of one column in a singletable

杀马特。学长 韩版系。学妹 提交于 2019-11-28 11:59:03
I've got a question regarding a SQL-select-query: The table contains several columns, one of which is an Integer-column called "size" - the task I'm trying to perform is query the table for the sum of all rows (their values), or to be more exact get a artifical column in my ResultSet called "overallSize" which contains the sum of all "size"-values in the table. Preferable it would be possible to use a WHERE-clause to add only certain values ("WHERE bla = 5" or something similar). The DB-engine is HSQLDB (HyperSQL), which is compliant to SQL2008. Thank you in advance :) SELECT SUM(size) AS

How to use HSQLDB in Oracle query syntax mode?

拜拜、爱过 提交于 2019-11-28 10:52:38
I am trying to use HSQLDB as an embedded database in a spring application (for testing). As the target production database is Oracle, I would like to use HSQLDBs Oracle syntax mode feature. In the Spring config I use <jdbc:embedded-database type="HSQL" id="dataSource"> </jdbc:embedded-database> <jdbc:initialize-database data-source="dataSource" enabled="true"> <jdbc:script location="classpath:schema.sql"/> </jdbc:initialize-database> And in schema.sql at the top I wrote: SET DATABASE SQL SYNTAX ORA TRUE; However, when running my test, I get the following error: java.sql.SQLException:

Internal HSQL database complains about privileges

做~自己de王妃 提交于 2019-11-28 09:55:26
I'm setting up a standalone Java service with an in-process, in-memory HSQL database. Persistence.xml <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="manager"> <class>tr.silvercar.data.entities.User</class> <properties> <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" /> <property name="javax.persistence.jdbc.user" value="sa" /> <property name=

HSQL database user lacks privilege or object not found error

China☆狼群 提交于 2019-11-28 08:57:32
I am trying to use hsqldb-2.3.4 to connect from Spring applicastion. I created data base using the following details Type : HSQL Database Engine Standalone Driver: org.hsqldb.jdbcDriver URL: jdbc:hsqldb:file:mydb UserName: SA Password: SA I created a table named ALBUM under "MYDB" schema In spring configuration file: <bean id="jdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate"> <constructor-arg ref="dbcpDataSource" /> </bean> <bean id="dbcpDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"

Unit Test raises : HsqlException user lacks privilege or object not found: ROWNUM

假如想象 提交于 2019-11-28 07:39:20
问题 I've got an issue with Hibernate when executing my unit tests, here is the issue I get : org.springframework.dao.InvalidDataAccessResourceUsageException: user lacks privilege or object not found: ROWNUM; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: user lacks privilege or object not found: ROWNUM .... Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: ROWNUM I'm using : <hibernate.version>4.1.0.Final</hibernate.version> <hsqldb

“Found: bit, expected: boolean” after Hibernate 4 upgrade

最后都变了- 提交于 2019-11-28 06:16:19
I'm trying to upgrade from Hibernate 3.6.5 to 4.0 (and from Spring 3.0.5 to 3.1 which is required for Hibernate 4 support). Now, with both MySQL and HSQL, I'm running into this problem with persistent boolean fields: Caused by: org.hibernate.HibernateException: Wrong column type in PUBLIC.PUBLIC.EVENT for column Checked. Found: bit, expected: boolean at org.hibernate.mapping.Table.validateColumns(Table.java:282) at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1268) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155) at org.hibernate.internal

How can I wipe data from my HSQLDB after every test?

此生再无相见时 提交于 2019-11-28 04:05:50
I had some JUnit tests already written in my project which used to populate data in the setup method. Now I have added maven to my project and I want to execute all test cases form maven i.e. using mvn test. The problem now is that my data base is not cleared after every test class has run. I need to clear the HSQLDB after test cases of each class have run. You can clear the data by dropping the schema. The default schema is called PUBLIC. If you execute the SQL satement below, it will clear all data and drop all tables. DROP SCHEMA PUBLIC CASCADE Alternatively, if you need the table and

How do I reset my database state after each unit test without making the whole test a transaction?

删除回忆录丶 提交于 2019-11-28 02:29:54
问题 I'm using Spring 3.1.1.RELEASE, Hibernate 4.1.0.Final, JPA 2, JUnit 4.8.1, and HSQL 2.2.7. I want to run some JUnit tests on my service methods, and after each test, I would like any data written to the in-memory database to be rolled back. However, I do NOT want the entire test to be treated as a transaction. For example in this test @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ "classpath:test-context.xml" }) public class ContractServiceTest { … @Autowired private