<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <base href="https://hibernate.atlassian.net" />
<title>Message Title</title>
</head>
<body class="jira" style="color: #333; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.429">
<table id="background-table" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f5f5f5; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt">
<!-- header here -->
<tr>
<td id="header-pattern-container" style="padding: 0px; border-collapse: collapse; padding: 10px 20px">
<table id="header-pattern" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt">
<tr>
<td id="header-avatar-image-container" valign="top" style="padding: 0px; border-collapse: collapse; vertical-align: top; width: 32px; padding-right: 8px"> <img id="header-avatar-image" class="image_fix" src="https://secure.gravatar.com/avatar/7e0530edba059123f9f5c14864fe471a?d=mm&s=48" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top" />
</td>
<td id="header-text-container" valign="middle" style="padding: 0px; border-collapse: collapse; vertical-align: middle; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> <a class="user-hover" rel="fabmars" id="email_fabmars" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=fabmars" style="color:#6c797f;; color: #3b73af; text-decoration: none">Fabien Marsaud</a> <strong>updated</strong> an issue
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td id="email-content-container" style="padding: 0px; border-collapse: collapse; padding: 0 20px">
<table id="email-content-table" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-spacing: 0; border-collapse: separate">
<tr>
<!-- there needs to be content in the cell for it to render in some clients -->
<td class="email-content-rounded-top mobile-expand" style="padding: 0px; border-collapse: collapse; color: #fff; padding: 0 15px 0 16px; height: 15px; background-color: #fff; border-left: 1px solid #ccc; border-top: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom: 0; border-top-right-radius: 5px; border-top-left-radius: 5px; height: 10px; line-height: 10px; padding: 0 15px 0 16px; mso-line-height-rule: exactly">
</td>
</tr>
<tr>
<td class="email-content-main mobile-expand " style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #fff">
<table class="page-title-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt">
<tr>
<td class="page-title-pattern-first-line " style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; padding-top: 10px"> <a href="https://hibernate.atlassian.net/browse/HHH" style="color: #3b73af; text-decoration: none">Hibernate ORM</a> / <a href="https://hibernate.atlassian.net/browse/HHH-10262" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-f7a6ab1f-f8a2-4614-a8a8-a493c24d0aee" height="16" width="16" border="0" align="absmiddle" alt="Bug" style="vertical-align: text-bottom" /></a> <a href="https://hibernate.atlassian.net/browse/HHH-10262" style="color: #3b73af; text-decoration: none">HHH-10262</a>
</td>
</tr>
<tr>
<td style="vertical-align: top;; padding: 0px; border-collapse: collapse; padding-right: 5px; font-size: 20px; line-height: 30px; mso-line-height-rule: exactly" class="page-title-pattern-header-container"> <span class="page-title-pattern-header" style="font-family: Arial, sans-serif; padding: 0; font-size: 20px; line-height: 30px; mso-text-raise: 2px; mso-line-height-rule: exactly; vertical-align: middle"> <a href="https://hibernate.atlassian.net/browse/HHH-10262" style="color: #3b73af; text-decoration: none">Enumerated(String) Primary Key fetched as byte[]</a> </span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="email-content-main mobile-expand wrapper-special-margin" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #fff; padding-top: 10px; padding-bottom: 5px">
<table class="keyvalue-table" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt">
<tr>
<th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">
Change By:
</th>
<td style="padding: 0px; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <a class="user-hover" rel="fabmars" id="email_fabmars" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=fabmars" style="color:#6c797f;; color: #3b73af; text-decoration: none">Fabien Marsaud</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="email-content-main mobile-expand issue-description-container" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #fff; padding-top: 5px; padding-bottom: 10px">
<table class="text-paragraph-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 2px">
<tr>
<td class="text-paragraph-pattern-container mobile-resize-text " style="padding: 0px; border-collapse: collapse; padding: 0 0 10px 0"> <span class="diffcontext">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</span> <span class="diffaddedchars" style="background-color:#ddfade;"> (dialect TenSeven used)</span> <span class="diffcontext">.<br /><br />So we were compelled to bump to 4.3.11, and, facing the issue below, we tried with 5.0.2 without success.<br /><br />One of the entities has an Enum(String) PK. It used to work well with Hibernate 3.6 as per [ANN-744]:<br />{color:#14892c}@Entity<br />@Table(name="status")<br />public class Status {<br /> private Organ organ;<br /> private boolean active;<br /> <br /> public Status() {}<br /> public Status(Organ organ, boolean active) {<br /> this.organ = organ;<br /> this.active = active;<br /> }<br /> <br /> @Id<br /> @GeneratedValue(generator="assignedGen")<br /> @GenericGenerator(name="assignedGen", strategy="assigned")<br /> @Enumerated(EnumType.STRING)<br /> @Column(name="organ", length=30, nullable=false)<br /> public Organ getOrgan() {<br /> return organ;<br /> }<br /> <br /> @Basic<br /> @Column(name="active", nullable=false)<br /> public boolean isActive() {<br /> return active;<br /> }<br /> // and setters too<br />}{color}<br /><br />The enum itself being as simple an enum can be::<br />{color:#14892c}public enum Organ {<br /> AAAA,<br /> BBBB,<br /> CCCC;<br />}{color}<br /><br />If I generate the DDL scripts, I get this, which is perfectly OK:<br />create table status (organ varchar(30) not null, active boolean not null, primary key (organ));<br /><br />Now, when I launch the application, as soon as it fetches entities from this table, this exception is thrown:<br />{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'.<br />* at org.apache.derby.client.am.Cursor.coercionError(Unknown Source)<br /> at org.apache.derby.client.am.Cursor.getBytes(Unknown Source)<br /> ... 124 more<br /><br />2015-11-09T01:03:54.138+0100|Severe: javax.ejb.EJBException<br /> at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:750)<br /> at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:700)<br /> at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:505)<br /> at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566)<br /> at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2074)<br /> at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2044)<br /> at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:220)<br /> at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)<br /> at com.sun.proxy.$Proxy244.getAllStatus(Unknown Source)<br /> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br /> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)<br /> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br /> at java.lang.reflect.Method.invoke(Method.java:497)<br /> at org.jboss.weld.util.reflection.Reflections.invokeAndUnwrap(Reflections.java:434)<br /> at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:127)<br /> at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)<br /> at org.jboss.weld.bean.proxy.InjectionPointPropagatingEnterpriseTargetBeanInstance.invoke(InjectionPointPropagatingEnterpriseTargetBeanInstance.java:67)<br /> at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:100)<br /> at com.xxxxxxxxxxxxxxx.v2.core.common.CommonManager$712301675$Proxy$_$$_Weld$EnterpriseProxy$.getAllStatus(Unknown Source)<br /> at com.xxxxxxxxxxxxxxx.v2.site.framework.ApplicationManager.reloadStatus(ApplicationManager.java:209)<br /><br />Caused by: org.hibernate.exception.DataException: could not execute query<br /> at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:52)<br /> at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)<br /> at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)<br /> at org.hibernate.loader.Loader.doList(Loader.java:2614)<br /> at org.hibernate.loader.Loader.doList(Loader.java:2594)<br /> at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2423)<br /> at org.hibernate.loader.Loader.list(Loader.java:2418)<br /> at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109)<br /> at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1705)<br /> at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363){color}<br /><br />Needless to say I also tried to remove the @GeneratedValue/@GenericGenerator lines to no avail.<br /><br />Unless this behavior is mandated by the JPA spec, it looks to me we have a regression here.</span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="email-content-main mobile-expand " style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #fff">
<table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px">
<tr>
<td id="actions-pattern-container" valign="middle" style="padding: 0px; border-collapse: collapse; padding: 10px 0 10px 24px; vertical-align: middle; padding-left: 0">
<table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt">
<tr>
<td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0px; vertical-align: middle"> <a href="https://hibernate.atlassian.net/browse/HHH-10262#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none"> <img class="actions-pattern-action-icon-image" src="cid:jira-generated-image-static-comment-icon-eecd6616-0dfa-4c9a-8b40-279aae0bcc6d" alt="Add Comment" title="Add Comment" height="16" width="16" border="0" style="vertical-align: middle" /> </a>
</td>
<td class="actions-pattern-action-text-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px"> <a href="https://hibernate.atlassian.net/browse/HHH-10262#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none">Add Comment</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- there needs to be content in the cell for it to render in some clients -->
<tr>
<td class="email-content-rounded-bottom mobile-expand" style="padding: 0px; border-collapse: collapse; color: #fff; padding: 0 15px 0 16px; height: 5px; line-height: 5px; background-color: #fff; border-top: 0; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; mso-line-height-rule: exactly">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td id="footer-pattern" style="padding: 0px; border-collapse: collapse; padding: 12px 20px">
<table id="footer-pattern-container" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt">
<tr>
<td id="footer-pattern-text" class="mobile-resize-text" width="100%" style="padding: 0px; border-collapse: collapse; color: #999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px">
This message was sent by Atlassian JIRA <span id="footer-build-information">(v7.0.0-OD-08-005#70107-<span title="5fb2f7e0c016d05ff672e1e32fcd963de6cf92ae" data-commit-id="5fb2f7e0c016d05ff672e1e32fcd963de6cf92ae}">sha1:5fb2f7e</span>)</span>
</td>
<td id="footer-pattern-logo-desktop-container" valign="top" style="padding: 0px; border-collapse: collapse; padding-left: 20px; vertical-align: top">
<table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt">
<tr>
<td id="footer-pattern-logo-desktop-padding" style="padding: 0px; border-collapse: collapse; padding-top: 3px"> <img id="footer-pattern-logo-desktop" src="cid:jira-generated-image-static-footer-desktop-logo-b7fcd7d2-6a8f-4eb5-bd7c-1709d4c56eac" alt="Atlassian logo" title="Atlassian logo" width="169" height="36" class="image_fix" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>