h2

Hibernate H2 specify drop table order

喜你入骨 提交于 2020-01-06 05:26:26
问题 I have pretty much the same problem like this user. Hibernate can't drop the tables of my in-memory test database after each SpringBootTest (e.g. when running mvn test). The desired behavior would be ddl-auto=create-drop , but this doesn't work. I think the reason could be an invalid order of the DROP TABLE statements, so that Hibernate tries to delete tables on which other tables still depend on. My data.sql script contains only INSERT statements and the schema is automatically created based

can not delete my h2 database files with DeleteDbFiles.execute using java

我们两清 提交于 2020-01-06 04:31:14
问题 I want delete h2 database files with DeleteDbFiles.execute("./data", "mydb", false), but getting following error : org.h2.message.DbException: Cannot delete file "dir/data/mydb.mv.db". and Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Cannot delete file "dir/data/mydb.mv.db". I tried to close EntityManager em (em.close()) and EntityManagerFactory emf (emf.close()) then delete files but still getting same error. I tried to delete @persistencecontext from mainForm but still getting same

Why does my Entity does not work with SpringBoot although it works without

本秂侑毒 提交于 2020-01-06 02:52:48
问题 (Please note : while investigating on this issue I better spotted the source of problem that I introduce here) I am very new to Hibernate and SpringBoot. My project deals with a search engine which indexing (javafx client) and searching (web client) parts are separated. The web client uses SpringBoot and during the process of the user's request, I need to retrieve information on the Solr Index to search against. These information are stored in a Hibernate / H2 local database where I use the

Why doesn't my alias show up in INFORMATION_SCHEMA.FUNCTION_ALIASES?

不羁岁月 提交于 2020-01-06 02:33:07
问题 I'm using H2 DB v1.4.182 for my test environment. It acts as a substitute in place of Oracle, which is the production vendor. I have a few aliases I create using a script in my test environment: CREATE ALIAS IF NOT EXISTS REGEXP_LIKE as $$ boolean regexpLike(String s, String p) { return java.util.regex.Pattern.compile(p).matcher(s).find(); } $$; CREATE ALIAS IF NOT EXISTS TO_NUMBER as $$ long toNumber(String s) { return Long.valueOf(s); } $$; CREATE ALIAS if NOT EXISTS fn_val_check3 for

H2 in-memory database error “Data conversion error converting” when using UUID as primary key

陌路散爱 提交于 2020-01-06 02:32:28
问题 I got the following error when using UUID as primary key with Slick with H2 in-memory database. I've tried to debug this for days, but no luck: Data conversion error converting "00000000-0000-0000-0000-000000000001" Here's the code that can reproduce this issue: import java.util.UUID import slick.driver.H2Driver.api._ import scala.concurrent.Await import scala.concurrent.duration.Duration object Main { class Tasks(tag: Tag) extends Table[(String, Option[UUID])](tag, "tasks") { def name: Rep

H2 console - looking at the database via browser shows old data

不打扰是莪最后的温柔 提交于 2020-01-05 07:27:09
问题 I'm using H2 database for a simple web application. When I try and view the data via the H2 console web browser, it doesn't seem to update with the latest data in the database. For example: I add a new record to a table using my web app and when I do a select * from the table I added the record to, it doesn't show the new record. I have the following settings for the Login when I connect to H2 console via the browser: Saved Settings: Generic H2 (Embedded) Setting Name: Generic H2 (Embedded)

With H2 Database can I perform a SQL query on CSV text read from a Java Reader e.g. StringReader?

亡梦爱人 提交于 2020-01-04 16:57:29
问题 Is there a way to perform SQL queries on CSV text held in memory and read in from a Java Reader e.g. StringReader. org.h2.tools.Csv.read(Reader reader, String[] colNames) would allow me to retrieve a result set containing all the rows and columns. However, I actually want to perform a query on the CSV text read from the Reader. The background - I receive a file containing multiple CSV sections for each entity, see Can H2 Database query a CSV file containing multiple sections of different

H2 SQL Date Comparison

江枫思渺然 提交于 2020-01-04 04:21:06
问题 In an H2 database on a column of type TIMESTAMP how do I run a query SELECT * FROM RECORDS WHERE TRAN_DATE < '2012/07/24' 回答1: Try '2012-07-24' http://www.h2database.com/html/grammar.html?highlight=dateType&search=date#date 来源: https://stackoverflow.com/questions/11634403/h2-sql-date-comparison

H2 console error: No suitable driver found for 08001/0

纵然是瞬间 提交于 2020-01-03 16:51:12
问题 Hello Im having problem with viewing my schema in H2 console Database: Im using spring boot: spring.datasource.initialize=true spring.datasource.url=jdbc:h2:~/test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MV_STORE=FALSE;MVCC=FALSE spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= spring.h2.console.enabled=true this is my login page: so what i see inside is standard console view , without my tables and yet my app is working fine. 回答1: In

Load Spring-Boot Database with Test Data

十年热恋 提交于 2020-01-03 15:59:33
问题 Goal: Leverage spring-boot Data Initialize features to create a simple database and load it with data. Problem: Receiving an error during spring-boot start up. org.hibernate.tool.hbm2ddl.SchemaExport : Column "FIRSTNAME" not found; SQL statement More of the spring-boot start-up output: 2015-03-06 17:32:30.919 INFO 3688 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from URL [file:/E:/spring-workspace/TestApp/target/classes/schema.sql] 2015-03-06 17:32:30.926 INFO 3688