hsqldb

Missing Sequences in HSQL for testing

北慕城南 提交于 2019-12-07 01:29:21
问题 I have a Oracle database where I have to use sequences for the primary key. This all works well as I have control over the sequence number. My problem is with my tests. Using Spring I create an HSQL db and test against this. This database is constructed by looking at all my entities. All my entities for the sake of working with Oracle have a sequence name specified. The trouble is that when I construct the HSQL db it cannot find the sequence (which I expect) My tests pass but I end up with

How to import data to an in-memory database?

我的梦境 提交于 2019-12-06 19:41:26
Are there any ways to import data in databases such as MS SQL, MySQL into in-memory databases like HSQLDB, H2 etc ? H2 supports a special database URL that initialized the database from a SQL script file : "jdbc:h2:mem;INIT=RUNSCRIPT FROM '~/create.sql'" HSQLDB and Apache Derby don't support such a feature as far as I know. I think you need to do query the data out from MS SQL import the data into in-memory DB with its API Either SQL expressions or DB related APIs In Hibernate: Adding import.sql to the class path works great, hbm2dll checks if the file exists and executes it. The only details

Hibernate entity only one column, no name

≯℡__Kan透↙ 提交于 2019-12-06 16:49:55
I want to map one column, without using a column name. I am using a count entity, and the want to use mulple different queries with the same entity : @Entity public class CountDTO extends Number { @Id // below causes an error in my test, hsql not same syntax @Column(name = 'COUNT') private Long count; In my prod (oracle) database I can just do select count() as COUNT from ... however, the same syntax doesn't work using hypersql in-memory db ? Is their an oracle/hsql compatible way to map a single column alias in HQL ? Your issue is that COUNT is a reserved keyword for HSQL , but not for Oracle

Oracle sql developer - export DDL - only create table sql

a 夏天 提交于 2019-12-06 16:09:21
I want to run unit tests by generating all tables in HSQLDB, present in my oracle database. For that I want to export all DDL create table statements from oracle tables. I tried export database, but along with create table sql I am getting lot other SQLs like, " PARTITION BY RANGE ("CREATION_DATE") " etc. How do I export all oracle tables(schema) to HSQLDB? is there any better way? You can use the DBMS_METADATA.GET_DDL() function to get the table definition, and modify what is included with the SET_TRANSFORM_PARAM() options, specifically in this case the PARTITIONING parameter. There are lots

Hibernate or hsql does not respect column length

大憨熊 提交于 2019-12-06 15:57:46
I have an application that uses hibernate to generate tables (since my application is still under development) for HSQL db. In my domain model I have set @Basic @Column(name = "about", length = 10) private String about; When I open my db using DBVisualizer I can see that everything is set up properly except it is not working my column accepts values that are way over 10 characters long. When I try to run the query manually in the DBVisualier it fails as it should but hibernate lets it run. Also very strange is when I use the file (in stead of in memory db) so that I can see the db structure

something funny with embedded hsql

自作多情 提交于 2019-12-06 14:03:37
i'm just curious about something.I'm using hsql in myproject (embedded of course).At some time i felt the need to visualize what hibernate was generating.I took a free copy of dbvisualizer. here is the hsqljdbc.properties jdbc.url=jdbc:hsqldb:file:mydb;create=true hibernate hbm2ddl.auto=create i downloaded the hsql 1.8.0_10. i did all the required procedure.i could connect and see the tables but after that changes made to the table don't seem be willing to show up.then i've tried to delete the db generate a new one but still.You got any idea in this? I usually Derby but i've realized lately

Connect databases to HSQLDB Server

[亡魂溺海] 提交于 2019-12-06 12:58:57
问题 I'm using version hsqldb-1.8 in a stand-alone way. I want to start the server with some databases. I'd like to use the command line from the HSQLDB documentation : java -cp ../lib/hsqldb.jar org.hsqldb.Server -database.0 file:mydb -dbname.0 xdb My problem is I have the script of each database I need and this command line creates a new database, without using my script. May the problem comes from one of these points : The location of my script The extension of my script which is a SQL-file

How to fix HSQL DataSource + TxM where identity always return 0

筅森魡賤 提交于 2019-12-06 11:24:38
I am using Hibernate to do my ORM stuff w/ HSQL for tests. It seems that a connection is fetched to do the insert and then returned. Straight after that HIbernate gets a connection then tries to fetch the identity from HSQL but that returns 0 which is obviously wrong. WHen i was running w/out a tm and datasource using a plain pooled connection everything worked but with the new tm + ds i am getting this problem. The answer is the DataSource should be tx aware, so that connections are sticky for each new tx. The original problem was a different connection was used to fetch the identity of the

PARTITION BY alternative in HSQLDB

最后都变了- 提交于 2019-12-06 08:40:53
I would like to fire the query suggested in https://stackoverflow.com/a/3800572/2968357 on a HSQLDB database using select * such as WITH tmpTable AS ( SELECT p.* , ROW_NUMBER() OVER(PARTITION BY p.groupColumn order by p.groupColumn desc) AS rowCount FROM sourceTable p) SELECT * FROM tmpTable WHERE tmpTable.rowCount = 1 but getting the following error: Caused by: org.hsqldb.HsqlException: unexpected token: PARTITION required: ) meaning PARTITION BY is not supported. Is there a work-around for my specific query on HSQLDB? The second query in that answer is supported by HSQLDB. If you use the

object is not an instance of declaring class -Hibernate

柔情痞子 提交于 2019-12-06 08:11:32
问题 I am new to HIbernate and was practicing some examples on One-to-many mapping but I am not getting why it is throwing error. 1)Employee.java package com.common.pojo; import java.util.Set; public class Employee { private int id; private String name; private Set certificate; public Employee (){} public Employee(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name)