[jboss-user] [JBoss Tools] - JPA validation fails
Jesper Skov
do-not-reply at jboss.com
Mon Feb 27 14:39:55 EST 2012
Jesper Skov [https://community.jboss.org/people/jskovjyskebankdk] created the discussion
"JPA validation fails"
To view the discussion, visit: https://community.jboss.org/message/720006#720006
--------------------------------------------------------------
Hi,
I just closed an issue I created against Dali: https://bugs.eclipse.org/bugs/show_bug.cgi?id=372478 https://bugs.eclipse.org/bugs/show_bug.cgi?id=372478 (I included the text below)
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.
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.
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.
We see it in more than one class. Maybe it's just a problem with the coding style here :^0
On the other hand, switching the JPA platform to Generic fixes the problem, so maybe not.
I just tried the JBoss Tools nightly build from yesterday (on 3.7sr2) and could still reproduce.
Is it something I should file a Jira issue for?
Thx,
Jesper
------ from the closed Eclipse issue -------
Build Identifier: Build id: 20120216-1857
We see a false error from the validation rule: Database/Column/Column cannot be
resolved.
The class with the validation error is this:
@Entity
@Table(name = "PasswordResourceAuditLog", uniqueConstraints =
@UniqueConstraint(columnNames = { "timestamp" }))
public class PasswordResourceAuditLogEntry extends UUIDEntity implements
LogEntry, Serializable {
@Column(length = 50)
private String username;
private String dataSourceName;
@Temporal(TemporalType.TIMESTAMP)
private Date timestamp;
@OneToOne(fetch=FetchType.EAGER)
private PasswordAttributes attributes;
...
The field attributes gets a validation error:
Column "attributes" cannot be resolved on table "PASSWORDRESOURCEAUDITLOG"
The class PasswordAttributes looks like this:
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Entity
abstract public class PasswordAttributes extends UUIDEntity {
public abstract PasswordAttributes copy();
public abstract PasswordType getType();
public void setType(PasswordType type){
//dummy method due to EL
}
}
and in turn:
@MappedSuperclass
public class UUIDEntity implements Serializable {
@Id @GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid",strategy = "uuid")
@Column(length=32)
@Size(max=32, min=32)
protected String id;
@SuppressWarnings("unused")
@Version
private Long version;
public String getId() {
return id;
}
}
Looking in the database (tables created by Hibernate, no custom configuration
as far as I know), the column is actually called ATTRIBUTES_ID.
We would expect the validator to look for this, not a column named ATTRIBUTES.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/720006#720006]
Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120227/952be598/attachment-0001.html
More information about the jboss-user
mailing list