Re: [h2] Re: Auto Increment statement is giving an error when passing null with H2DB 2.2.224 version

2024-04-02 Thread 'Balamurali Krishna Ippili' via H2 Database
Hi Evgenij, Thank you so much for your response. Sure , I will check the feasibility in our application to pass an array of column names or column indexes instead of that constant to request the exact columns. Regards, Balamurali On Fri, Mar 29, 2024 at 7:06 PM Evgenij Ryazanov wrote: > When

Re: [h2] Re: Auto Increment statement is giving an error when passing null with H2DB 2.2.224 version

2024-03-29 Thread Evgenij Ryazanov
When you use Statement.RETURN_GENERATED_KEYS, driver may choose what it should return by itself, see JDBC™ 4.3 Specification, section 13.6. Modern versions of H2 return primary key columns, identity columns, and columns with non-constant default expression (including expressions inherited from

Re: [h2] Re: Auto Increment statement is giving an error when passing null with H2DB 2.2.224 version

2024-03-29 Thread 'Balamurali Krishna Ippili' via H2 Database
Hi Evgenij and Team, As per my understanding the following prepared statement is executed perfectly on H2DB and inserted in a row. *prep1250: INSERT INTO `nim_entity_properties` (`id` ,`entity_type` ,`property_name` ,`data_type` ,`is_custom_property` ) VALUES (?,?,?,?,?) {1: NULL, 2: 'incident'

Re: [h2] Re: Auto Increment statement is giving an error when passing null with H2DB 2.2.224 version

2024-03-29 Thread 'Balamurali Krishna Ippili' via H2 Database
Small correction on the table definition: create table nim_entity_properties( id int auto_increment DEFAULT ON NULL, entity_type varchar(40), property_name varchar(50) ) On Fri, Mar 29, 2024 at 4:09 PM Balamurali Krishna Ippili < balamurali.ipp...@broadcom.com> wrote: > Hi Evgenij and Team, > >

Re: [h2] Re: Auto Increment statement is giving an error when passing null with H2DB 2.2.224 version

2024-03-29 Thread 'Balamurali Krishna Ippili' via H2 Database
Hi Evgenij and Team, I have changed the tabl;e definition as like below: create table nim_entity_properties( id int auto_increment DEFAULT ON NULL, entity_type varchar(40), property_name varchar(50), data_type varchar(40) ) And now I am able to insert the row with the auto increment

Re: [h2] Re: Auto Increment statement is giving an error when passing null with H2DB 2.2.224 version

2024-03-29 Thread 'Balamurali Krishna Ippili' via H2 Database
Hi Evgenij, Thanks for your quick reply and suggestion. Really appreciate it. I will check further on your suggestion. Thanks, Balamurali On Fri, Mar 29, 2024 at 3:06 PM Evgenij Ryazanov wrote: > Hi! > > You shouldn't try to insert NULL into columns with NOT NULL constrains. > Only non-null va

[h2] Re: Auto Increment statement is giving an error when passing null with H2DB 2.2.224 version

2024-03-29 Thread Evgenij Ryazanov
Hi! You shouldn't try to insert NULL into columns with NOT NULL constrains. Only non-null values or DEFAULT may be inserted into them. H2 allows such incorrect insertions into identity columns only in Legacy, HSLQDB, MariaDB, and MySQL compatibility modes. You can also enable this feature for

[h2] Re: Auto Increment statement is giving an error when passing null with H2DB 2.2.224 version

2024-03-29 Thread 'Balamurali Krishna Ippili' via H2 Database
I have tried to alter the table column for id as below and that is allowing the insert statement but it is adding the new row with a duplicate id (1) and the insertion successful. But I am expecting that id to be count of current rows +1 so that is not helpful for me . ALTER TABLE nim_entity_prop