Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data too long for column 'id' at row 1 with MariaDB and JDBC #561

Closed
ilopmar opened this issue May 27, 2020 · 3 comments
Closed

Data too long for column 'id' at row 1 with MariaDB and JDBC #561

ilopmar opened this issue May 27, 2020 · 3 comments
Assignees
Labels
status: pr submitted A pull request has been submitted for the issue type: bug Something isn't working
Milestone

Comments

@ilopmar
Copy link
Contributor

ilopmar commented May 27, 2020

After updating from Micronaut Data 1.0.3 snapshot to 1.1.0 snapshot the JDBC MariaDB test application doesn't start when running on the JVM.

Steps to Reproduce

  • git clone https://github.com/micronaut-graal-tests/micronaut-data-jdbc-graal
  • cd micronaut-data-jdbc-graal
  • git checkout master_mariadb
  • Start MariaDB: docker run -p 3306:3306 -it --rm -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=pets mariadb:10.4.8-bionic
  • ./gradlew run

Expected Behaviour

The application should start and load some data on the database.

Actual Behaviour

The application fails to start with:

15:36:48.257 [main] INFO  example.Application - Populating data
15:36:48.334 [main] DEBUG io.micronaut.data.query - Executing Batch SQL Insert: INSERT INTO `owner` (`age`,`name`) VALUES (?,?)
15:36:48.346 [main] DEBUG io.micronaut.data.query - Executing Batch SQL Insert: INSERT INTO `pet` (`owner_id`,`name`,`type`,`id`) VALUES (?,?,?,?)
15:36:48.355 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: SQL error executing INSERT: (conn=17) Data too long for column 'id' at row 1
io.micronaut.data.exceptions.DataAccessException: SQL error executing INSERT: (conn=17) Data too long for column 'id' at row 1
        at io.micronaut.data.jdbc.operations.DefaultJdbcRepositoryOperations.lambda$persistInBatch$11(DefaultJdbcRepositoryOperations.java:1128)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.executeWrite(AbstractSynchronousTransactionManager.java:177)
        at io.micronaut.data.jdbc.operations.DefaultJdbcRepositoryOperations.persistInBatch(DefaultJdbcRepositoryOperations.java:1066)
        at io.micronaut.data.jdbc.operations.DefaultJdbcRepositoryOperations.persistAll(DefaultJdbcRepositoryOperations.java:1050)
        at io.micronaut.data.runtime.intercept.DefaultSaveAllInterceptor.intercept(DefaultSaveAllInterceptor.java:51)
        at io.micronaut.data.runtime.intercept.DefaultSaveAllInterceptor.intercept(DefaultSaveAllInterceptor.java:34)
        at io.micronaut.data.intercept.DataIntroductionAdvice.intercept(DataIntroductionAdvice.java:80)
        at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:69)
        at io.micronaut.validation.ValidatingInterceptor.intercept(ValidatingInterceptor.java:106)
        at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:69)
        at example.repositories.PetRepository$Intercepted.saveAll(Unknown Source)
        at example.Application.init(Application.java:50)
        at example.$ApplicationDefinition$$exec1.invokeInternal(Unknown Source)
        at io.micronaut.context.AbstractExecutableMethod.invoke(AbstractExecutableMethod.java:146)
        at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:3182)
        at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:81)
        at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:69)
        at example.Application$ApplicationEventListener$init1$Intercepted.onApplicationEvent(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.notifyEventListeners(DefaultBeanContext.java:1273)
        at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1258)
        at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:242)
        at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:166)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:64)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:294)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:280)
        at example.Application.main(Application.java:30)
Caused by: java.sql.BatchUpdateException: (conn=17) Data too long for column 'id' at row 1
        at org.mariadb.jdbc.MariaDbStatement.executeBatchExceptionEpilogue(MariaDbStatement.java:309)
        at org.mariadb.jdbc.ClientSidePreparedStatement.executeBatch(ClientSidePreparedStatement.java:293)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
        at com.sun.proxy.$Proxy14.executeBatch(Unknown Source)
        at io.micronaut.data.jdbc.operations.DefaultJdbcRepositoryOperations.lambda$persistInBatch$11(DefaultJdbcRepositoryOperations.java:1094)
        ... 25 common frames omitted
Caused by: java.sql.SQLDataException: (conn=17) Data too long for column 'id' at row 1
        at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:232)
        at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:164)
        at org.mariadb.jdbc.MariaDbStatement.executeBatchExceptionEpilogue(MariaDbStatement.java:305)
        ... 33 common frames omitted
Caused by: java.sql.SQLException: Data too long for column 'id' at row 1
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1599)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1461)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1424)
        at org.mariadb.jdbc.internal.protocol.AsyncMultiRead.call(AsyncMultiRead.java:149)
        at org.mariadb.jdbc.internal.protocol.AsyncMultiRead.call(AsyncMultiRead.java:67)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Environment Information

  • Operating System: Linux Mint 19.3
  • Micronaut Version: 2.0.0 snapshot (also happens with 1.3.6 snapshot) and Micronaut Data 1.1.0 snapshot
  • JDK Version: 8
@graemerocher graemerocher added the type: bug Something isn't working label May 27, 2020
@graemerocher graemerocher added this to the 1.1.0 milestone May 27, 2020
@sdelamo sdelamo self-assigned this Jun 1, 2020
@sdelamo
Copy link
Contributor

sdelamo commented Jun 1, 2020

Error is related to UUID and @AutoPopulated.

Replacing

@Entity
public class Pet {

    @AutoPopulated
    @Id
    private UUID id;

with:

@Entity
public class Pet {

    @GeneratedValue
    @Id
    private Long id;

solves the problem.

@ilopmar
Copy link
Contributor Author

ilopmar commented Jun 1, 2020

But I don't want a Long id but a UUID one...

@sdelamo
Copy link
Contributor

sdelamo commented Jun 1, 2020

I know. I am just documenting the issue.

sdelamo added a commit that referenced this issue Jun 1, 2020
@sdelamo sdelamo added status: pr submitted A pull request has been submitted for the issue and removed status: in progress labels Jun 1, 2020
sdelamo added a commit that referenced this issue Jun 1, 2020
sdelamo pushed a commit to micronaut-projects/gitlab-micronaut-graal-tests that referenced this issue May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pr submitted A pull request has been submitted for the issue type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants