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.
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
… 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
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.
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 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”
)
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…
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.
# '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