javax.ejb.EJBException

Hibernate JIRA | Fabien Marsaud | 1 year ago
  1. 0

    We're migrating an app from EE6 to EE7 and Glassfish/Payara 4 mandates us to update Hibernate to a JPA2-compliant implementation. We still had Hibernate 3.6.10 previously and we used the good old Criteria API. We also have EJB3 and CDI in our legacy code, and the database is Derby 10.10 (dialect TenSeven used). So we were compelled to bump to 4.3.11, and, facing the issue below, we tried with 5.0.2 without success. One of the entities has an Enum(String) PK. It used to work well with Hibernate 3.6 as per [ANN-744]: {color:#14892c}@Entity @Table(name="status") public class Status { private Organ organ; private boolean active; public Status() {} public Status(Organ organ, boolean active) { this.organ = organ; this.active = active; } @Id @GeneratedValue(generator="assignedGen") @GenericGenerator(name="assignedGen", strategy="assigned") @Enumerated(EnumType.STRING) @Column(name="organ", length=30, nullable=false) public Organ getOrgan() { return organ; } @Basic @Column(name="active", nullable=false) public boolean isActive() { return active; } // and setters too }{color} The enum itself being as simple an enum can be:: {color:#14892c}public enum Organ { AAAA, BBBB, CCCC; }{color} If I generate the DDL scripts, I get this, which is perfectly OK: create table status (organ varchar(30) not null, active boolean not null, primary key (organ)); Now, when I launch the application, as soon as it fetches entities from this table, this exception is thrown: {color:#14892c}*Caused by: org.apache.derby.client.am.ColumnTypeConversionException: An attempt was made to get a data value of type 'byte[]' from a data value of type 'VARCHAR'. * at org.apache.derby.client.am.Cursor.coercionError(Unknown Source) at org.apache.derby.client.am.Cursor.getBytes(Unknown Source) ... 124 more 2015-11-09T01:03:54.138+0100|Severe: javax.ejb.EJBException at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:750) at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:700) at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:505) at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2074) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2044) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:220) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88) at com.sun.proxy.$Proxy244.getAllStatus(Unknown Source) 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:497) at org.jboss.weld.util.reflection.Reflections.invokeAndUnwrap(Reflections.java:434) at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:127) at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56) at org.jboss.weld.bean.proxy.InjectionPointPropagatingEnterpriseTargetBeanInstance.invoke(InjectionPointPropagatingEnterpriseTargetBeanInstance.java:67) at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:100) at com.xxxxxxxxxxxxxxx.v2.core.common.CommonManager$712301675$Proxy$_$$_Weld$EnterpriseProxy$.getAllStatus(Unknown Source) at com.xxxxxxxxxxxxxxx.v2.site.framework.ApplicationManager.reloadStatus(ApplicationManager.java:209) Caused by: org.hibernate.exception.DataException: could not execute query at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:52) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) at org.hibernate.loader.Loader.doList(Loader.java:2614) at org.hibernate.loader.Loader.doList(Loader.java:2594) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2423) at org.hibernate.loader.Loader.list(Loader.java:2418) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1705) at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363){color} Needless to say I also tried to remove the @GeneratedValue/@GenericGenerator lines to no avail. Unless this behavior is mandated by the JPA spec, it looks to me we have a regression here.

    Hibernate JIRA | 1 year ago | Fabien Marsaud
    javax.ejb.EJBException
  2. 0

    We're migrating an app from EE6 to EE7 and Glassfish/Payara 4 mandates us to update Hibernate to a JPA2-compliant implementation. We still had Hibernate 3.6.10 previously and we used the good old Criteria API. We also have EJB3 and CDI in our legacy code, and the database is Derby 10.10 (dialect TenSeven used). So we were compelled to bump to 4.3.11, and, facing the issue below, we tried with 5.0.2 without success. One of the entities has an Enum(String) PK. It used to work well with Hibernate 3.6 as per [ANN-744]: {color:#14892c}@Entity @Table(name="status") public class Status { private Organ organ; private boolean active; public Status() {} public Status(Organ organ, boolean active) { this.organ = organ; this.active = active; } @Id @GeneratedValue(generator="assignedGen") @GenericGenerator(name="assignedGen", strategy="assigned") @Enumerated(EnumType.STRING) @Column(name="organ", length=30, nullable=false) public Organ getOrgan() { return organ; } @Basic @Column(name="active", nullable=false) public boolean isActive() { return active; } // and setters too }{color} The enum itself being as simple an enum can be:: {color:#14892c}public enum Organ { AAAA, BBBB, CCCC; }{color} If I generate the DDL scripts, I get this, which is perfectly OK: create table status (organ varchar(30) not null, active boolean not null, primary key (organ)); Now, when I launch the application, as soon as it fetches entities from this table, this exception is thrown: {color:#14892c}*Caused by: org.apache.derby.client.am.ColumnTypeConversionException: An attempt was made to get a data value of type 'byte[]' from a data value of type 'VARCHAR'. * at org.apache.derby.client.am.Cursor.coercionError(Unknown Source) at org.apache.derby.client.am.Cursor.getBytes(Unknown Source) ... 124 more 2015-11-09T01:03:54.138+0100|Severe: javax.ejb.EJBException at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:750) at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:700) at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:505) at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2074) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2044) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:220) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88) at com.sun.proxy.$Proxy244.getAllStatus(Unknown Source) 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:497) at org.jboss.weld.util.reflection.Reflections.invokeAndUnwrap(Reflections.java:434) at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:127) at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56) at org.jboss.weld.bean.proxy.InjectionPointPropagatingEnterpriseTargetBeanInstance.invoke(InjectionPointPropagatingEnterpriseTargetBeanInstance.java:67) at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:100) at com.xxxxxxxxxxxxxxx.v2.core.common.CommonManager$712301675$Proxy$_$$_Weld$EnterpriseProxy$.getAllStatus(Unknown Source) at com.xxxxxxxxxxxxxxx.v2.site.framework.ApplicationManager.reloadStatus(ApplicationManager.java:209) Caused by: org.hibernate.exception.DataException: could not execute query at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:52) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) at org.hibernate.loader.Loader.doList(Loader.java:2614) at org.hibernate.loader.Loader.doList(Loader.java:2594) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2423) at org.hibernate.loader.Loader.list(Loader.java:2418) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1705) at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363){color} Needless to say I also tried to remove the @GeneratedValue/@GenericGenerator lines to no avail. Unless this behavior is mandated by the JPA spec, it looks to me we have a regression here.

    Hibernate JIRA | 1 year ago | Fabien Marsaud
    javax.ejb.EJBException
  3. 0

    function to_date with oracle and hql hibernate

    Stack Overflow | 3 years ago | franco
    org.hibernate.exception.DataException: could not execute query
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hibernate. PSQLException: bad value for type int : admin

    Stack Overflow | 2 years ago | Marco A. Braghim
    org.hibernate.exception.DataException: could not execute query
  6. 0

    Hibernate Community • View topic - org.hibernate.exception.DataException: could not execute que

    hibernate.org | 7 months ago
    org.hibernate.exception.DataException: could not execute query

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.exception.DataException

      could not execute query

      at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert()
    2. Hibernate
      SessionImpl.list
      1. org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:52)
      2. org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
      3. org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
      4. org.hibernate.loader.Loader.doList(Loader.java:2614)
      5. org.hibernate.loader.Loader.doList(Loader.java:2594)
      6. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2423)
      7. org.hibernate.loader.Loader.list(Loader.java:2418)
      8. org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109)
      9. org.hibernate.internal.SessionImpl.list(SessionImpl.java:1705)
      9 frames