org.mariadb.jdbc.internal.common.QueryException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basics' at line 1 Query is: sql : 'select distinct case when count(basicsimpl0_.id)>0 then cast(1 as bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basicsimpl0_.email=?', parameters : ['@hibernate.com']

Hibernate JIRA | Martin Šimka | 1 year ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    test [o.h.jpa.test.criteria.simplecase.BasicSimpleCaseTest#testCaseLiteralResult2|https://github.com/hibernate/hibernate-orm/blob/master/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/simplecase/BasicSimpleCaseTest.java#L105] fails on mysql/mariadb {code:java} public void testCaseLiteralResult2() { EntityManager em = getOrCreateEntityManager(); em.getTransaction().begin(); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Boolean> cq = cb.createQuery( Boolean.class ); Root<Customer> expense_ = cq.from( Customer.class ); em.createQuery( cq.distinct( true ).where( cb.equal( expense_.get( "email" ), "@hibernate.com" ) ).multiselect( cb.selectCase() .when( cb.gt( cb.count( expense_ ), cb.literal( 0L ) ), true ) .otherwise( false ) ) ).getSingleResult(); } {code} {noformat} org.mariadb.jdbc.internal.common.QueryException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basics' at line 1 Query is: sql : 'select distinct case when count(basicsimpl0_.id)>0 then cast(1 as bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basicsimpl0_.email=?', parameters : ['@hibernate.com'] at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:969) at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:1021) at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:1003) at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:271) {noformat} cast to bit isn't supported in mysql/mariadb - https://mariadb.com/kb/en/mariadb/convert/ possible workaround is to enclose resulting object in literal this fails: {code:java} when( cb.gt( cb.count( expense_ ), cb.literal( 0L ) ), true ) {code} this passes: {code:java} .when( cb.gt( cb.count( expense_ ), cb.literal( 0L ) ), cb.literal( true ) ) {code}

    Hibernate JIRA | 1 year ago | Martin Šimka
    org.mariadb.jdbc.internal.common.QueryException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basics' at line 1 Query is: sql : 'select distinct case when count(basicsimpl0_.id)>0 then cast(1 as bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basicsimpl0_.email=?', parameters : ['@hibernate.com']
  2. 0

    test [o.h.jpa.test.criteria.simplecase.BasicSimpleCaseTest#testCaseLiteralResult2|https://github.com/hibernate/hibernate-orm/blob/master/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/simplecase/BasicSimpleCaseTest.java#L105] fails on mysql/mariadb {code:java} public void testCaseLiteralResult2() { EntityManager em = getOrCreateEntityManager(); em.getTransaction().begin(); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Boolean> cq = cb.createQuery( Boolean.class ); Root<Customer> expense_ = cq.from( Customer.class ); em.createQuery( cq.distinct( true ).where( cb.equal( expense_.get( "email" ), "@hibernate.com" ) ).multiselect( cb.selectCase() .when( cb.gt( cb.count( expense_ ), cb.literal( 0L ) ), true ) .otherwise( false ) ) ).getSingleResult(); } {code} {noformat} org.mariadb.jdbc.internal.common.QueryException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basics' at line 1 Query is: sql : 'select distinct case when count(basicsimpl0_.id)>0 then cast(1 as bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basicsimpl0_.email=?', parameters : ['@hibernate.com'] at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:969) at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:1021) at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:1003) at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:271) {noformat} cast to bit isn't supported in mysql/mariadb - https://mariadb.com/kb/en/mariadb/convert/ possible workaround is to enclose resulting object in literal this fails: {code:java} when( cb.gt( cb.count( expense_ ), cb.literal( 0L ) ), true ) {code} this passes: {code:java} .when( cb.gt( cb.count( expense_ ), cb.literal( 0L ) ), cb.literal( true ) ) {code}

    Hibernate JIRA | 1 year ago | Martin Šimka
    org.mariadb.jdbc.internal.common.QueryException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basics' at line 1 Query is: sql : 'select distinct case when count(basicsimpl0_.id)>0 then cast(1 as bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basicsimpl0_.email=?', parameters : ['@hibernate.com']
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Not able to add environment.

    GitHub | 1 year ago | sangeethah
    org.jooq.exception.DataAccessException: SQL [insert into `account` (`name`, `kind`, `uuid`, `description`, `state`, `created`, `data`) values (?, ?, ?, ?, ?, ?, ?)]; Column 'uuid' cannot be null
  5. 0

    Re: Document components

    manifoldcf-user | 2 years ago | Markus Schuch
    org.apache.manifoldcf.core.interfaces.ManifoldCFException: Database exception: SQLException doing query (HY0000): You need to set exactly 3 parameters on the prepared statement

    Root Cause Analysis

    1. org.mariadb.jdbc.internal.common.QueryException

      You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basics' at line 1 Query is: sql : 'select distinct case when count(basicsimpl0_.id)>0 then cast(1 as bit) else cast(0 as bit) end as col_0_0_ from customer basicsimpl0_ where basicsimpl0_.email=?', parameters : ['@hibernate.com']

      at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult()
    2. mariadb-java-client
      MySQLStatement.execute
      1. org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:969)
      2. org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:1021)
      3. org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:1003)
      4. org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:271)
      4 frames