<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
<table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
<h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
<!-- To have a header image/logo replace the name below with your img tag -->
<!-- Email clients will render the images when the message is read so any image -->
<!-- must be made available on a public server, so that all recipients can load the image. -->
<a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
JPA validation fails
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/jskovjyskebankdk">Jesper Skov</a> in <i>JBoss Tools</i> - <a href="https://community.jboss.org/message/720006#720006">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span>I just closed an issue I created against Dali: </span><a class="jive-link-external-small" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=372478" target="_blank">https://bugs.eclipse.org/bugs/show_bug.cgi?id=372478</a><span> (I included the text below)</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>It appears that the JPA validation error (Column "attributes" cannot be found on table...) we get is due to a problem in JBoss Tools, Hibernate.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I wonder if we need to "do something" to make the validation pass, or it is indeed a bug. We can disable the validation as a workaround, but would like it working, obviously.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The reason I ask, is that it seems such an obvious problem, and I can't find anything currently open (or closed) in Jira to explain it.</p><p>We see it in more than one class. Maybe it's just a problem with the coding style here <span> :^0 </span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>On the other hand, switching the JPA platform to Generic fixes the problem, so maybe not.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I just tried the JBoss Tools nightly build from yesterday (on 3.7sr2) and could still reproduce.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Is it something I should file a Jira issue for?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thx,</p><p>Jesper</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>------ from the closed Eclipse issue -------</p><p>Build Identifier: Build id: 20120216-1857</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>We see a false error from the validation rule: Database/Column/Column cannot be</p><p>resolved.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The class with the validation error is this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>@Entity</p><p>@Table(name = "PasswordResourceAuditLog", uniqueConstraints =</p><p>@UniqueConstraint(columnNames = { "timestamp" }))</p><p>public class PasswordResourceAuditLogEntry extends UUIDEntity implements</p><p>LogEntry, Serializable {</p><p>    @Column(length = 50)</p><p>    private String username;</p><p>    private String dataSourceName;</p><p>    @Temporal(TemporalType.TIMESTAMP)</p><p>    private Date timestamp;</p><p>    @OneToOne(fetch=FetchType.EAGER)</p><p>    private PasswordAttributes attributes;</p><p>...</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The field attributes gets a validation error:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Column "attributes" cannot be resolved on table "PASSWORDRESOURCEAUDITLOG"</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The class PasswordAttributes looks like this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)</p><p>@Entity</p><p>abstract public class PasswordAttributes extends UUIDEntity {</p><p>    public abstract PasswordAttributes copy();</p><p>    public abstract PasswordType getType();</p><p>    public void setType(PasswordType type){</p><p>        //dummy method due to EL</p><p>    }    </p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and in turn:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>@MappedSuperclass</p><p>public class UUIDEntity implements Serializable {</p><p>    @Id @GeneratedValue(generator="system-uuid")</p><p>    @GenericGenerator(name="system-uuid",strategy = "uuid")    </p><p>    @Column(length=32)</p><p>    @Size(max=32, min=32)</p><p>    protected String id;</p><p>    @SuppressWarnings("unused")</p><p>    @Version</p><p>    private Long version;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    public String getId() {</p><p>        return id;</p><p>    }</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Looking in the database (tables created by Hibernate, no custom configuration</p><p>as far as I know), the column is actually called ATTRIBUTES_ID.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>We would expect the validator to look for this, not a column named ATTRIBUTES.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/720006#720006">going to Community</a></p>
<p style="margin: 0;">Start a new discussion in JBoss Tools at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>