Error in table with ENUM field.
See original GitHub issueI have a MySQL database with the following table
CREATE TABLE `qp1_integracao` ( `ID` INTEGER(11) NOT NULL AUTO_INCREMENT, `AGE` INTEGER(10) NOT NULL, `ENUMCOLUMN` ENUM('UOL', 'GOOGLE', 'BUSCAPE') NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB;
…when I run the program thows the following Exception
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:784) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:765) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:319) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.blackdread.sqltojava.SqlToJavaApplication.main(SqlToJavaApplication.java:45) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_171]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.8.RELEASE.jar:2.1.8.RELEASE]
Caused by: java.lang.IllegalStateException: An enum field must have its enum entity name set
at org.blackdread.sqltojava.util.JdlUtils.lambda$writeField$0(JdlUtils.java:115) ~[classes/:na]
at java.util.Optional.orElseThrow(Optional.java:290) ~[na:1.8.0_171]
at org.blackdread.sqltojava.util.JdlUtils.writeField(JdlUtils.java:115) ~[classes/:na]
at org.blackdread.sqltojava.util.JdlUtils.writeEntity(JdlUtils.java:90) ~[classes/:na]
at org.blackdread.sqltojava.service.logic.ExportService.export(ExportService.java:61) ~[classes/:na]
at org.blackdread.sqltojava.SqlToJavaApplication.run(SqlToJavaApplication.java:53) [classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:781) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
... 10 common frames omitted
Do not recognize the ENUM column type ?, or it needs an specific treatment ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Mysql enum field problems - Stack Overflow
1 Answer 1 ... From the Empty or NULL Enumeration Values documentation: If you insert an invalid value into an ENUM (that is,...
Read more >MySQL 8.0 Reference Manual :: 11.3.5 The ENUM Type
An ENUM is a string object with a value chosen from a list of permitted values that are enumerated explicitly in the column...
Read more >SQL error when updating columns with ENUMs type and a ...
Step 2: I'm going into the structure tab of this table and changing the enum's 'type' column image. Step 3: Error on save...
Read more >MySQL Enum Data Truncated for Column: Solution - Bobcares
MySQL enum data truncated for column refers to an error. The issue arises when the column status is of the type enum.
Read more >A Comprehensive Guide to Using MySQL ENUM Data Type
This tutorial introduces you to MySQL ENUM data type and shows you how to define ENUM columns for storing enumeration values.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I already have a test that covers native enum for both Postgres and MySQL. This can be closed.
I do not remember what else was done but I think we can check the different test cases you added and have an enum type in DB then see result