Hi,
I've raised a JIRA so we can fix it for the next release.
https://issues.apache.org/jira/browse/CLK-583
I'm not sure if anybody is actively working on expanding the Hibernate
API, however any contributions in this area is welcome.
Thanks.
bob
wateray wateray wrote:
Hi List
I'm [[email protected] <mailto:[email protected]>].
I debug the source of HibernateForm.
Maybe it is a bug.
Apache click version: Version 2.1.0-RC1
****************************************
385. protected void applyMetaData() {
if (metaDataApplied) {
return;
}
try {
Class valueClass =
ClickUtils.classForName(classField.getValue());
String classname = getClassname(valueClass);
ClassMetadata metadata =
getSessionFactory().getClassMetadata(classname);
String[] propertyNames = metadata.getPropertyNames();
boolean[] propertyNullability =
metadata.getPropertyNullability();
for (int i = 0; i < propertyNames.length; i++) {
Field field = getField(propertyNames[i]);
if (field != null) {
404. field.setRequired(propertyNullability[i]);
//This isn't correct.
}
}
} catch (ClassNotFoundException cnfe) {
throw new RuntimeException(cnfe);
}
metaDataApplied = true;
}
****************************************
The row of number 404 "field.setRequired(propertyNullability[i]);"
isn't correct.
The result of propertyNullability[i] is that:
when I set " <column name="name" length="200" not-null="true" />" .
Then propertyNullability will return false.
Means the field can't be null, So
field.setRequired(propertyNullability[i] == false),
or field.setRequired( !propertyNullability[i] ). Not
field.setRequired(propertyNullability[i]).
I find click integrate with hibernate while simplely. But the other
ORM Cayenne have many API to use.
May the next realse will more deeply integrate with hibernate?
Best Regards
Wateray
Hi,
The idea behind HibernateForm is to automate some common functionality
such as validation. In this case HibernateForm will automatically set
the field readonly value based on whether the database column allow a
null value or not. I guess HibernateForm is overriding the value you set
explicitly.
Perhaps HibernateForm should only set the Field readonly flag if the
value is false?
kind regards
bob
[email protected] <mailto:[email protected]> wrote:
Hello List
When I use HibernateForm, I find something is not correct.
Eg. TextField name = new TextField("name", "name", true);
The required flag doesn't work.
And form.isValid() don't validate.
Is this a bug?