Hi,
I've used the validator in some projects (non db-specific) everything works fine. But now I'd like to use it with
hibernate (orm). Within the documentation there is the following:
Quote:
Out of the box, Hibernate Annotations (as of Hibernate 3.5.x) will translate the constraints you have defined for your entities into mapping metadata. For example, if a property of your entity is annotated @NotNull, its columns will be declared as not null in the DDL schema generated by Hibernate.
Now I have this Entity:
Code:
@Entity
@Table(name="CONTACTS")
public class Contact implements Serializable {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@Column(name="ID")
@Length(max=36)
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
I would expect that the column ID would have a length of 36 but it has 255 (the default).
Within the deployment I'll see this:
Quote:
13:56:59.520 DEBUG o.h.tool.hbm2ddl.SchemaUpdate - create table CONTACTS (ID varchar(255) not null, primary key (ID))
13:57:00.381 INFO o.h.tool.hbm2ddl.SchemaUpdate - schema update complete
Within the documentation of hibernate validator it's mentioned that the ddl-generation is on by default and has to disabled explicitly.
I haven't done this and hibernate tells me that it has found the validator long before the line above.
Currently I'm using Hibernate 3.5.2-Final and Hibernate-Validator 4.0.2GA
Has anybody some ideas?
yours
marc