JMIX 2.0 .. cannot empty application setting column

I tried to save an empty value for an application setting column.
Does not work.
I can change the value and save it but cannot remove the value from the column and then save it.
I tried via application settings and also in the entity manager.

KR
Roland

Hi Roland,

Cannot reproduce this.
How the attribute in your settings entity is defined?
Could you provide a test project?

Regards,
Konstantin

Hi Konstantin,
I think I found the issue.
I am using postgresql for main and also for additional DBs.
And, like in the application settings where JMIX is creating character varying columns,
I also use that type in own entities.
When you try to save an empty string like ‘’ it will end in doing nothing.
Looks like Postgresql character varying needs NULL to empty a column when saving.

Could you tell me how to handle that in JMIX?

… just checked the beforeCommit listener…
that one is also not fired when I just empty a column in the detail view …
which means I cannot use a listener for an interim solution :frowning:

… and also tried to use setValue(null) in the controller, but then I get the Null value is not supported error…
actually I do not see any workaround when using JMIX 2.1 with Postgresql character varying column types…
which is a blocker for my environment

KR
Roland

Hi Roland,

Tried on Postgres, still cannot reproduce the issue.
Please provide a test project or at least step-by-step instructions with examples from your source code.

Hi Konstantin,

attached a project…
pls look at daily_tours entity.
In the DB (ddl see below) paj_number and tour_number are both defined as char var 50.
In the entity class I set paj_number to @Lob and tour_number as string only.
In the controller I set paj_number to textarea and tour_number to textfield.
paj_number I can empty and save, tour_number I can change the value but an empty column will not be saved.

postgresql version 15.3

jmix3.zip (187.6 KB)

postgresql ddl:
CREATE TABLE IF NOT EXISTS public.daily_tours
(
id serial NOT NULL primary key,
date character varying(20) COLLATE pg_catalog.“default” NOT NULL,
tour_id integer,
vehicle_id integer,
starttime timestamp without time zone,
paj_number character varying(50) COLLATE pg_catalog.“default”,
tour_number character varying(50) COLLATE pg_catalog.“default”
)

KR Roland

and I just tried to swap it, paj_number as textfield string
and tour_number as textarea and @lob
works like expected…
now I can empty the tour_number but not any longer the paj_number

which means:
I have a workaround now… can keep the char var setting in the DB but set
the columns to lob and textarea…

and one more: it is fine enough to set it to textarea in the controller…
in the entity class I can keep it as a string without the @lob annotation…

Unfortunately cannot reproduce this on your project:
screencast 2023-11-16 10-49-35

PostgreSQL 14.9

Hi Konstantin,

is there any logging/tracing I can activate to get more detailed information?
Or, to find out where in the classes that action is triggered for postgres DB.
I will then try to override it and put in some logging.

KR
Roland

For starters, set debug level for these loggers:

# 'debug' level logs SQL generated by EclipseLink ORM
logging.level.eclipselink.logging.sql = info

# 'debug' level logs data store operations
logging.level.io.jmix.core.datastore = info