java.lang.IllegalArgumentException when running sample code with MYSQL
MYSQL Server Version: 8.0.23 mysql-connector-java Version: 8.0.23
When attempting to run the Sample code located here: https://github.com/dieselpoint/norm/blob/master/src/test/java/com/dieselpoint/norm/SampleCode.java
The below Exception is thrown: java.lang.IllegalArgumentException: Can not set long field org.example.SampleCode$Name.id to java.math.BigInteger
Please can you advise if this is a known issue or if there is a known fix as the same problem is also occurring in my own code when using this library.
It's a mysql jdbc bug pertaining to generated keys. There is a workaround. I'm at a ballgame right now, but I'll find it when I get back.
On Sat, Apr 24, 2021, 5:21 PM Damien @.***> wrote:
MYSQL Server Version: 8.0.23 mysql-connector-java Version: 8.0.23
When attempting to run the Sample code located here: https://github.com/dieselpoint/norm/blob/master/src/test/java/com/dieselpoint/norm/SampleCode.java
The below Exception is thrown: java.lang.IllegalArgumentException: Can not set long field org.example.SampleCode$Name.id to java.math.BigInteger
Please can you advise if this is a known issue or if there is a known fix as the same problem is also occurring in my own code when using this library.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dieselpoint/norm/issues/55, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAITHKQFR23L7K5MVJ6XRLTTKM77TANCNFSM43QSN26Q .
https://bugs.mysql.com/bug.php?id=101823
I don't recall now if there is a workaround. You could make your primary key a BigInteger.
On Sat, Apr 24, 2021, 5:31 PM Chris Cleveland @.***> wrote:
It's a mysql jdbc bug pertaining to generated keys. There is a workaround. I'm at a ballgame right now, but I'll find it when I get back.
On Sat, Apr 24, 2021, 5:21 PM Damien @.***> wrote:
MYSQL Server Version: 8.0.23 mysql-connector-java Version: 8.0.23
When attempting to run the Sample code located here: https://github.com/dieselpoint/norm/blob/master/src/test/java/com/dieselpoint/norm/SampleCode.java
The below Exception is thrown: java.lang.IllegalArgumentException: Can not set long field org.example.SampleCode$Name.id to java.math.BigInteger
Please can you advise if this is a known issue or if there is a known fix as the same problem is also occurring in my own code when using this library.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dieselpoint/norm/issues/55, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAITHKQFR23L7K5MVJ6XRLTTKM77TANCNFSM43QSN26Q .
Hi CCleve,
I hope you enjoyed your ball game!
I did attempt to make my PK a big int before opening this bug with the below snippet:
@Id @GeneratedValue public BigInteger id;
However, a SQLSyntaxErrorException is thrown due to Incorrect column specifier for column 'id'.
I have found however that an upsert does appear to work without error, I'm yet to see if this will function for my use case however.
Thanks
Fixed by #79