I set the db url to
spring.datasource.url=jdbc:h2:~/test;INIT=RUNSCRIPT FROM
'~/Documents/Projects/regular-encourager/encourage/src/test/resources/data.sql'
In src/test/resources/data.sql I included a script like this:
*drop table ENCOURAGEMENT if exists; drop TYPE Category if exists; drop
TYPE Tone if exists; drop TYPE Topic if exists; CREATE TYPE Category AS
ENUM('WhoIAmInChrist','Default'); CREATE TYPE Tone AS ENUM('Default',
'Uplifting', 'Urging', 'Warning', 'Soothing', 'Comforting', 'Inspiring',
'Centering', 'Balanced'); CREATE TYPE Topic AS ENUM('Default',
'AcceptedInChrist', 'SignificantInChrist', 'SecureInChrist',
'NoAnxietyInChrist'); CREATE TABLE Encouragement(ID INT PRIMARY KEY,
CATEGORY Category, TOPIC Topic, TONE Tone, MESSAGE VARCHAR(512)); INSERT
INTO Encouragement VALUES(-1, 'Default', 'Default', 'Default', 'We walk by
Faith, not by Sight'); INSERT INTO Encouragement
VALUES(0,'WhoIAmInChrist','AcceptedInChrist','Uplifting','John 1:12 I am
God''s child.'); INSERT INTO Encouragement
VALUES(1,'WhoIAmInChrist','AcceptedInChrist','Uplifting','John 15:15 As a
disciple, I am a friend of Jesus Christ.'); .....*
When I run the test, I see
*Hibernate: drop table if exists encouragement CASCADE Hibernate: create
table encouragement (id bigint not null, category varchar(255), message
varchar(255), tone varchar(255), topic varchar(255), primary key (id))
2023-01-13 18:39:08.297 INFO 18108 --- [ main]
o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform
implementation:
[org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]*
No Inserts after this!
Why aren't the inserts happening?
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/h2-database/2a545826-d1a7-429b-8d37-6f501bc66171n%40googlegroups.com.