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 number even if
I pass the null for the ID , however I am getting a different SQL exception
like below but the actual data inserted in a new row with proper ID number.

Caused by: java.sql.SQLException: *Unexpected ID column type STRING
(typeVal 12) in column ENTITY_TYPE(#2) is not a number*
at
com.j256.ormlite.jdbc.JdbcDatabaseConnection.getIdColumnData(JdbcDatabaseConnection.java:309)
~[ormlite-jdbc-4.48.jar:?]
at
com.j256.ormlite.jdbc.JdbcDatabaseConnection.insert(JdbcDatabaseConnection.java:179)
~[ormlite-jdbc-4.48.jar:?]
at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:91)
~[ormlite-core-4.48.jar:?]

Unfortunately I cannot use compatibility MODEs like Legacy, MYSql etc...


*Any thoughts or suggestions on this?*



Thanks,
Balamurali

On Fri, Mar 29, 2024 at 3:55 PM Balamurali Krishna Ippili <
balamurali.ipp...@broadcom.com> wrote:

> 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 <kat...@gmail.com> wrote:
>
>> 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 any column in any compatibility mode
>> with ALTER TABLE tableName ALTER COLUMN columnName SET DEFAULT ON NULL
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "H2 Database" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to h2-database+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/h2-database/0f828877-acab-49eb-a39a-8df33b23d309n%40googlegroups.com
>> <https://groups.google.com/d/msgid/h2-database/0f828877-acab-49eb-a39a-8df33b23d309n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/CAG6_yCA7b%2Bnyas-r2EBHj_bNVk9Z12WG3SK05_Z7iBPsLeNY%2Bg%40mail.gmail.com.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to