h2

SequenceGenerator problem with unit testing in Hsqldb/H2

核能气质少年 提交于 2019-12-23 18:24:59
问题 I have tried using both Hsqldb and H2 for unit testing but facing problem with sequence generators. Field declaration looks like this. @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="keyword_seq") @SequenceGenerator(name="keyword_seq",sequenceName="KEYWORD_ID_SEQ", allocationSize=1) @Column(name="IM_KEYWORD_ID") private Long keywordId; When I try to test simple insert in this table in Hsqldb with following configuration, it gives error <prop key="hibernate.connection.driver

in memory database h2 how long keep connection open?

霸气de小男生 提交于 2019-12-23 13:13:48
问题 I am testing currently a H2 DB in memory mode. I set up a connection by h2Con = DriverManager.getConnection( "jdbc:h2:mem:db1", "SA", ""); I want to some imports with dbunit and set up dbUnits db connection IDataBaseConnection dBUnitConnection = new DatabaseConnection(h2con); and the imports which i want to query later So my question is, in memory mode, when can i close the connection? Normaly i do something like this try{ //some sql query }catch{ //error handling }finally{ if(connection!

H2 database collation strength: what to choose?

穿精又带淫゛_ 提交于 2019-12-23 12:49:53
问题 After a lot of reading and experimentation, it seems like I want PRIMARY strength for searching, but TERTIARY or IDENTICAL for ordering. Main question: Is that possible to achieve with H2 (or any other DB)? Secondary question: Am I the only one here or would any of you also like the above combination? Some confirmation would be helpful for my sanity. Background: It seems like the collation can only be set at the very beginning when creating the database. So I want to make sure to pick the

Cannot resolve class or package 'h2'

白昼怎懂夜的黑 提交于 2019-12-23 12:19:08
问题 I prepere back-end for my web app. In my project (SpringBoot + Maven) i would like to add h2 date base. According to tutorials from web: Added to application.properties server.port = 8088 spring.h2.console.enabled=true spring.h2.console.path=/h2 spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.username=sa spring.datasource.password= spring.datasource.driverClassName=org.h2.Driver //h2 seems to be NOT found spring.jpa.show-sql=true Added dependencies to pom.xml <dependency> <groupId

H2 DB in Spring Boot Hibernate does not generate Db Schema

梦想与她 提交于 2019-12-23 11:52:07
问题 I want my Spring Application to autogenerate the DB schema and tables... I've read some Q&A to this topic and I've set my DB URL to: H2DataSource.setUrl("jdbc:h2:mem:tmp.db;INIT=CREATE SCHEMA IF NOT EXISTS GPSTRACKER"); and I've annotated my Entities like: @Entity @Table(name="tblGps", schema= "GPSTRACKER") but the db schema is still not created. Here is my log output. Hibernate is trying to create the tables, but can't find the schema! What am I doing wrong? Any suggestions? Log Output 2015

H2 database: how to protect with encryption, without exposing file encryption key

天涯浪子 提交于 2019-12-23 10:51:03
问题 We are using Java + H2 Database in server mode, because we do not want users from accessing database file. To add more protection to database file, we plan to use AES encryption (add CIPHER=AES to database URL) in case the storage is stolen. However, each user will also need to supply file protection password when connecting ([file password][space][user password]). Although users do not have access to database file, knowing the encryption key (file protection password) will make the

H2 database default value of TIMESTAMP column

我们两清 提交于 2019-12-23 09:00:19
问题 I am writing integration tests with H2 database. My database (generated) initialization include this script (because generated join table does not have this column): ALTER TABLE INT_USR ADD IU_INSDTTM TIMESTAMP DEFAULT NOW(); This is how I create records: Integration integrationOne = createIntegration(firstId, "FIRST"); Integration integrationTwo = createIntegration(secondId, "SECOND"); flushAndClear(); userService.logRecentIntegration(integrationOne.getId(), user.getId()); flushAndClear();

H2 database default value of TIMESTAMP column

走远了吗. 提交于 2019-12-23 08:59:23
问题 I am writing integration tests with H2 database. My database (generated) initialization include this script (because generated join table does not have this column): ALTER TABLE INT_USR ADD IU_INSDTTM TIMESTAMP DEFAULT NOW(); This is how I create records: Integration integrationOne = createIntegration(firstId, "FIRST"); Integration integrationTwo = createIntegration(secondId, "SECOND"); flushAndClear(); userService.logRecentIntegration(integrationOne.getId(), user.getId()); flushAndClear();

Unknown data type when using an integer over NamedParameterJDBCTemplate on H2 [SPRING-BOOT]

断了今生、忘了曾经 提交于 2019-12-23 08:39:24
问题 I'm testing a Dao with an In-Memory DB with H2. I'm passing an int to the query with a map to execute it. This query is working OK on Oracle SQL, but is not succeding in H2. DAO @Override public int deleteCancelled(int days) { final Map<String, Object> namedParameters = new HashMap<String, Object>(); namedParameters.put(DAYS, days); namedParameters.put(STATUS, StatusEnum.CANCELLED.toString()); int updated = this.namedParameterJdbcTemplate.update(Query.QUERIES.DELETE_CANCELLED, namedParameters

RH2: Using R cannot connect to my H2 database

北战南征 提交于 2019-12-23 05:01:51
问题 I read the documentation of RH2 on CRAN but when I'm trying to connect to my H2 database I get this error: > library(RH2) Loading required package: chron Loading required package: RJDBC Loading required package: DBI Loading required package: rJava > con <- dbConnect(H2(), "jdbc:h2:mem:test") Error in .local(drv, ...) : could not find function ".verify.JDBC.result" WHere I'm wrong? 来源: https://stackoverflow.com/questions/13907092/rh2-using-r-cannot-connect-to-my-h2-database