Integration test error h2 database

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Integration test error h2 database



I have a grails 2.5.5 application and integration tests running in a h2 database, but the database create tables doesn´t work with domains with defaultValue mapping with 0 or 1, sample:


static mapping =
isManufacture(defaultValue: "b'0'")



Running grails test-app -integration show me this error


| Error 2018-08-10 14:23:40,102 [main] ERROR hbm2ddl.SchemaUpdate - Column "B" not found; SQL statement:
create table product (id bigint generated by default as identity, version bigint not null, approval_manufacturer_date timestamp, batch_validit



Mapping in the true or false form works fine!


static mapping =
isManufacture(defaultValue: false)



I want know, why h2 doesń´t recognized the mapping, and if exist difference between "b'0'" or false mapping domain field



Properties of my grails app



version 2.5.5
Mysql DB




1 Answer
1



The isManufactured looks to be a type Boolean. The default values of a Boolean would be either true or false. I am not sure what the "b'0'" would mean?





"b'0'" or "b'1'" is mysql boolean value, i think...
– Mister B
Aug 15 at 12:56





I think that is your problem. The Hibernate dialect should take care of the type conversion. You do not want to have DB specific code so you can switch between different DBs. That is one of the benefits of using Hibernate.
– Joe
Aug 15 at 17:53






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard