lunatech-labs/RESTEasy-CRUD-Play--module — Issue #6: Unknown field type
Author: vlastikcz
Created: 2011-12-11 21:34:59+00:00
State: open

Hello,
there is problem with the type attribute in @CRUDField. I'm using @ManyToOne fields and even of you manually define the type, it's raised Unknown field exception error.

I belive, there should be possible to define @CRUDField(type = Type.STRING), because you can use the @XmlIDREF (which is STRING) on the @ManyToOne field. Is this the best way to combine @ManyToOne and RestEASY module?

Here is my fix:

public Column(Property p, Field field, CRUDField crud) {
this.field = name = p.name;
editable = false;
autocomplete = false;
sortable = false;
Class fieldType = field.getType();
// setType(fieldType); <= problem
if(crud != null){
if(crud.name().length() > 0)
name = crud.name();
editable = crud.editable();
autocomplete = crud.autoComplete();
sortable = crud.sortable();
Type crudType = crud.type();
if(crudType != Type.DEFAULT) { // FIX
type = crudType.name();
} else { setType(fieldType); }

}
addValidation(field);
}