Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2759

Exception in TypedQuery.getResultList() w/more than 1 parameter using MariaDB

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: jdbc, jpa, query
    • Labels:
      None

      Description

      Executing TypedQuery.getResultList() on a query with more than 1 parameter yields an exception when using MariaDB Connector/J v2.3.0. Problem does not occur when using MySQL Connector against same MariaDB instance. Using a single parameter works as well. I tried setting openjpa.jdbc.DBDictionary property to 'mariadb' with no effect. Exception:

      2018-11-27 11:49:53,395 [RMI TCP Connection(4)-192.168.1.183] ERROR coop.psfc.common.shared.exceptions.CommonException -
      coop.psfc.common.shared.exceptions.CommonException: Failed to find members with member name='Ith Ein'; nested exception is:
      <openjpa-3.0.0-r422266:1833209 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: Could not set parameter at position 2 (values was '%Ith%')
      Query - conn:13(M) - "SELECT t0.MEMBER_NUMBER, t0.VERSION, t0.AMNESTY_DATETIME, t0.AMNESTY_GIVEN, t0.AMOUNT_FEE_PAID, t0.ASSOCIATED_EMAILS, t0.AUTH_SHOPPER_EXPIRE_DATE, t0.BALANCE_BANK_CHARGE, t0.BALANCE_CARD_CHARGE, t0.BALANCE_MISC_CHARGE, t0.BANK_BALANCE_MODTIME, t0.BANK_BALANCE_STATUS, t0.CARD_BALANCE_MODTIME, t0.CARD_BALANCE_STATUS, t0.CARD_ISSUED, t0.CARD_ISSUED_DATETIME, t0.CARD_ISSUED_STATE_MODTIME, t0.CARD_SUFFIX, t0.COMMITTEE_DATE, t0.DC_STATUS, t0.DC_STATUS_DATETIME, t0.dob, t0.EMAIL_ADDRESS, t0.EMAIL_CHANGE_DATETIME, t0.EXTENSION_START_DATE, t0.EXTENSION_STARTED, t0.FEE_PAYMENT_PLAN, t0.FEE_STATUS, t0.FEE_STATUS_MODTIME, t0.FIRST_NAME, t0.GRACE_DATE, t0.HAS_PHOTO, t0.HDG_DATE, t1.id, t1.VERSION, t1.ADDRESS_LINE_1, t1.ADDRESS_LINE_2, t1.ADDRESS_NOT_ON_FILE, t1.city, t1.CREATION_DATETIME, t1.FOREIGN_ADDRESS_1, t1.FOREIGN_ADDRESS_2, t1.FOREIGN_ADDRESS_3, t1.HIDDEN_HOUSEHOLD_SUSPECT, t1.HOUSEHOLD_INDEX, t1.inactive, t1.INVALID_ADDRESS, t1.MODIFICATION_DATE, t1.MOI_LETTER_RETURNED, t1.REASON_NOT_ON_FILE, t1.state, t1.status,..."
      FailedObject: SELECT o FROM Member o WHERE o.lastName LIKE ?1 AND o.firstName LIKE ?2 order by o.lastName, o.firstName asc [java.lang.String]
      at coop.psfc.membership.server.services.MemberService.findMembersLikeMemberName(MemberService.java:742)
      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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
      at com.sun.proxy.$Proxy63.findMembersLikeMemberName(Unknown Source)
      at coop.psfc.membership.server.services.MembershipService.findMembersLikeMemberName(MembershipService.java:1090)
      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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
      at sun.rmi.transport.Transport$1.run(Transport.java:200)
      at sun.rmi.transport.Transport$1.run(Transport.java:197)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: org.apache.openjpa.persistence.PersistenceException: Could not set parameter at position 2 (values was '%Ith%')
      Query - conn:13(M) - "SELECT t0.MEMBER_NUMBER, t0.VERSION, t0.AMNESTY_DATETIME, t0.AMNESTY_GIVEN, t0.AMOUNT_FEE_PAID, t0.ASSOCIATED_EMAILS, t0.AUTH_SHOPPER_EXPIRE_DATE, t0.BALANCE_BANK_CHARGE, t0.BALANCE_CARD_CHARGE, t0.BALANCE_MISC_CHARGE, t0.BANK_BALANCE_MODTIME, t0.BANK_BALANCE_STATUS, t0.CARD_BALANCE_MODTIME, t0.CARD_BALANCE_STATUS, t0.CARD_ISSUED, t0.CARD_ISSUED_DATETIME, t0.CARD_ISSUED_STATE_MODTIME, t0.CARD_SUFFIX, t0.COMMITTEE_DATE, t0.DC_STATUS, t0.DC_STATUS_DATETIME, t0.dob, t0.EMAIL_ADDRESS, t0.EMAIL_CHANGE_DATETIME, t0.EXTENSION_START_DATE, t0.EXTENSION_STARTED, t0.FEE_PAYMENT_PLAN, t0.FEE_STATUS, t0.FEE_STATUS_MODTIME, t0.FIRST_NAME, t0.GRACE_DATE, t0.HAS_PHOTO, t0.HDG_DATE, t1.id, t1.VERSION, t1.ADDRESS_LINE_1, t1.ADDRESS_LINE_2, t1.ADDRESS_NOT_ON_FILE, t1.city, t1.CREATION_DATETIME, t1.FOREIGN_ADDRESS_1, t1.FOREIGN_ADDRESS_2, t1.FOREIGN_ADDRESS_3, t1.HIDDEN_HOUSEHOLD_SUSPECT, t1.HOUSEHOLD_INDEX, t1.inactive, t1.INVALID_ADDRESS, t1.MODIFICATION_DATE, t1.MOI_LETTER_RETURNED, t1.REASON_NOT_ON_FILE, t1.state, t1.status,..."
      at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:5038)
      at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4998)
      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:134)
      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:115)
      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:67)
      at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheckedException(SelectResultObjectProvider.java:154)
      at org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:39)
      at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1262)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1015)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:871)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:802)
      at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:541)
      at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:274)
      at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:290)
      at coop.psfc.membership.server.dao.MemberDao.findMembersByMemberName(MemberDao.java:202)
      at coop.psfc.membership.server.dao.MemberDao.findMembersByMemberName(MemberDao.java:149)
      at coop.psfc.membership.server.dao.MemberDao.findMembersByMemberName(MemberDao.java:139)
      at coop.psfc.membership.server.services.MemberService.findMembersLikeMemberName(MemberService.java:734)
      ... 30 common frames omitted
      Caused by: java.sql.SQLException: Could not set parameter at position 2 (values was '%Ith%')
      Query - conn:13(M) - "SELECT t0.MEMBER_NUMBER, t0.VERSION, t0.AMNESTY_DATETIME, t0.AMNESTY_GIVEN, t0.AMOUNT_FEE_PAID, t0.ASSOCIATED_EMAILS, t0.AUTH_SHOPPER_EXPIRE_DATE, t0.BALANCE_BANK_CHARGE, t0.BALANCE_CARD_CHARGE, t0.BALANCE_MISC_CHARGE, t0.BANK_BALANCE_MODTIME, t0.BANK_BALANCE_STATUS, t0.CARD_BALANCE_MODTIME, t0.CARD_BALANCE_STATUS, t0.CARD_ISSUED, t0.CARD_ISSUED_DATETIME, t0.CARD_ISSUED_STATE_MODTIME, t0.CARD_SUFFIX, t0.COMMITTEE_DATE, t0.DC_STATUS, t0.DC_STATUS_DATETIME, t0.dob, t0.EMAIL_ADDRESS, t0.EMAIL_CHANGE_DATETIME, t0.EXTENSION_START_DATE, t0.EXTENSION_STARTED, t0.FEE_PAYMENT_PLAN, t0.FEE_STATUS, t0.FEE_STATUS_MODTIME, t0.FIRST_NAME, t0.GRACE_DATE, t0.HAS_PHOTO, t0.HDG_DATE, t1.id, t1.VERSION, t1.ADDRESS_LINE_1, t1.ADDRESS_LINE_2, t1.ADDRESS_NOT_ON_FILE, t1.city, t1.CREATION_DATETIME, t1.FOREIGN_ADDRESS_1, t1.FOREIGN_ADDRESS_2, t1.FOREIGN_ADDRESS_3, t1.HIDDEN_HOUSEHOLD_SUSPECT, t1.HOUSEHOLD_INDEX, t1.inactive, t1.INVALID_ADDRESS, t1.MODIFICATION_DATE, t1.MOI_LETTER_RETURNED, t1.REASON_NOT_ON_FILE, t1.state, t1.status,..."
      at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getSqlException(ExceptionMapper.java:271)
      at org.mariadb.jdbc.MariaDbPreparedStatementClient.setParameter(MariaDbPreparedStatementClient.java:480)
      at org.mariadb.jdbc.BasePrepareStatement.setString(BasePrepareStatement.java:1533)
      at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:315)
      at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.setString(LoggingConnectionDecorator.java:1390)
      at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:315)
      at org.apache.openjpa.jdbc.sql.DBDictionary.setString(DBDictionary.java:1279)
      at org.apache.openjpa.jdbc.sql.DBDictionary.setUnknown(DBDictionary.java:1486)
      at org.apache.openjpa.jdbc.sql.DBDictionary.setUnknown(DBDictionary.java:1464)
      at org.apache.openjpa.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:608)
      at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:517)
      at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:493)
      at org.apache.openjpa.jdbc.sql.SelectImpl.prepareStatement(SelectImpl.java:480)
      at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:421)
      at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:392)
      at org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalUnion.java:427)
      at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:230)
      at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:220)
      at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:93)
      at org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:33)
      ... 41 common frames omitted

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ihe63 Ithran Einhorn
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: