hsqldb

Hibernate, HSQL, and Update w/ Limits

三世轮回 提交于 2020-01-11 10:19:07
问题 Is it possible to limit the number of rows that are updated using Hibernate/HQL? For instance: Query q = em.createQuery("UPDATE MyObj o Set o.prop = :prop"); q.setParameter("prop", "foo"); q.setMaxResults(myLimit); int res = q.executeUpdate(); if (res > myLimit) { // This is entering here and I don't want it to! } I've been Googling around and such, and I am trying to use HQL so that I can do some unit tests using HSQL DB in memory dbs, as well as using MySql in deployment. MySql supports the

How to configure Hikari CP for HSQL in a Spring(4) context?

这一生的挚爱 提交于 2020-01-11 07:10:19
问题 i want to use Hikari CP in my Spring 4.0.3 context but seems i am missing something. My bean configuration looks like: <bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource"> <constructor-arg> <bean class="com.zaxxer.hikari.HikariConfig"> <constructor-arg> <props> <prop key="dataSource.driverClassName">${database.driver}</prop> <prop key="dataSource.jdbcUrl">${database.database.jdbc.url}</prop> <prop key="dataSource.port">${database.port}</prop> <prop key="dataSource.databaseName">$

How do you reset Spring JUnit application context after a test class dirties it?

大憨熊 提交于 2020-01-09 06:34:07
问题 I'm using Spring 3.1.1.RELEASE, JUnit 4.8.1 and the HSQL 2.7.7 in-memory database. I have one test class annotated as @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ "classpath:test-trainingSessionServiceContext.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class TrainingSessionServiceTest { The problem is, when I run "mvn clean test", it seems that all test classes run after the above class fail because the in-memory database is destroyed and

Truncating takes too much time hsqldb

若如初见. 提交于 2020-01-06 02:32:31
问题 I use HSQLDB 2.3.2 and I've got the following issues: My database has cached table with 10 000 000 records without any constraints and indexes. Its size is about ~900mb. I turn off autocommit mode and when I try to execute "Truncate table tableName", execution hangs but only dbName.backup is growing. And here's why: TRACE ENGINE:? - copyShadow [size, time] 2246252 9721 TRACE ENGINE:? - setFileModified flag set TRACE ENGINE:? - cache save rows [count,time] totals 24801,9921 operation 24801

Alter auto-generated sequence

别等时光非礼了梦想. 提交于 2020-01-05 08:03:34
问题 I use this to create auto-incremented id columns: id BIGSERIAL -- psql id BIGINT GENERATED BY DEFAULT AS IDENTITY -- hsql Now in unit tests i'd like to reset those sequences between tests. Is this possible? I target PostgreSQL and HSQLDB 回答1: TRUNCATE table RESTART IDENTITY; http://www.postgresql.org/docs/9.2/static/sql-truncate.html http://hsqldb.org/doc/guide/dataaccess-chapt.html#dac_truncate_statement 回答2: For PostgreSQL, you can use the pg_get_serial_sequence function to discover the

liferay migrate data from hsql to mysql

走远了吗. 提交于 2020-01-05 07:39:18
问题 I am having Liferay 6.2. It has some data in hsql. I need to import these data into mysql database. How can I import all data from hsql to mySQL. I am having following files in data/hsql folder lportal.lck (lck file) lportal (seems like data base dump) lportal.properties lportal.script Is there any way to import db using some script or changing some configuration files. 回答1: One way is you can try using the Data migration tool liferay provides, check out the Liferay User-guide and scroll to

HSQLDB unexpected token:?

为君一笑 提交于 2020-01-05 04:58:08
问题 I have a JAVAFX project using HSQLDB. When trying to set the SOURCE of a table I get an exception I think I understand, but since I cant fix it I guess I dont understand it. My SQL is: DROP TABLE temp IF EXISTS; CREATE TEXT TABLE temp(text_data LONGVARCHAR(10000)); SET TABLE temp SOURCE ?; INSERT INTO log(typ, json) SELECT SUBSTRING(text_data, 3, LOCATE('"', text_data, 3)-3),text_data FROM temp WHERE text_data <> ''; DROP TABLE temp IF EXISTS; Mutliple Statements somehow do not work for me

How do I get name of the target table and column of foreign key column with plain JDBC

别来无恙 提交于 2020-01-04 14:34:52
问题 I'm trying to make a piece of code using plain JDBC that fetches me the name of both target table and column of a foreign key of a specific column in specific table but going through the core interfaces I can't seem to find a direct way to do this. Is there a way to get such information about foreign keys through JDBC directly or do I have to resort to metadata queries to specific database, in this case HSQLDB. If I have to use the database specific metadata queries, which HSQLDB internal

Hibernate/hsqldb 2 Cannot Hydrate Blob Column

谁都会走 提交于 2020-01-04 01:56:11
问题 I am trying to load an entity with byte data (annotated with @Lob) from an HSQL 2.0 database using Hibernate 3.5.6. This entity is able to be saved without any problems and is loaded fine if it is in the cache (i.e. does not need to be hydrated). However, when the entity is not in the cache (needs to be hydrated), I receive the following exception: Caused by: org.hsqldb.HsqlException: incompatible data type in conversion: from SQL type BLOB to [B, value: instance of org.hsqldb.types

Connect to Open Office odb file using jdbc program

不问归期 提交于 2020-01-03 17:26:54
问题 I had written following code to connect to OpenOffice db . String db = "C:\\Documents and Settings\\hkonakanchi\\Desktop\\Test.odb"; Class.forName("org.hsqldb.jdbcDriver"); Connection con = DriverManager.getConnection("jdbc:hsqldb:file:" + db,"sa",""); Statement statement = con.createStatement(); ResultSet rs = statement.executeQuery("SELECT * FROM Emp"); while (rs.next()) { System.out.print("ID: " + rs.getString("ID")); System.out.print(" first name: " + rs.getString("firstname")); System