liquibase / liquibase-hanadb

Liquibase extension for HANA
Apache License 2.0
7 stars 15 forks source link

Liquibase create NVARCHAR instead of VARCHAR #38

Open radianer opened 3 years ago

radianer commented 3 years ago

Hi,

I have a change like this:

<column name="description" type="VARCHAR(255)"/>

if i run mvn liquibase:update it create the columns with NVARCHAR(255). This result in to validation errors if i start my spring boot application.

Can someone explain me that behavior or explain me how i can change that?

┆Issue is synchronized with this Jira Bug by Unito

zrav commented 3 years ago

We're also hitting this issue when running against HANA Cloud (4.00.000.00). With on-premise HANA (2.00.055.00) it works as expected.

EDIT: While I saw that liquibase-hanadb has explicit special-casing for version >= 4 that uses N for the string types, I noticed that it doesn't even matter, as HANA 4 silently converts the types to N anyway. So there's nothing that can be done here.

Now looking for a way to make Hibernate not explode due to unexpected data types. Unfortunately spring.jpa.properties.hibernate.use_nationalized_character_data=true doesn't have any effect...

r2-lf commented 3 years ago

Hi, @breglerj ! How can we help? Thanks!

breglerj commented 3 years ago

@zrav as you already found out HANA Cloud only supports N* string types. That's why the liquibase-hanadb has the explicit switch. You can find more information on the differences between HANA Cloud and HANA 2 in the SAP HANA Cloud Compatibility and Migration Information guide.

Hibernate has a HANA Cloud dialect (org.hibernate.dialect.HANACloudColumnStoreDialect) since version 5.4.15. That should get you around the unexpected data type errors.

zrav commented 3 years ago

@breglerj Thank you, that was the bit of information I was missing.