Olá, pessoal.
Estou tendo o seguinte problema. Tenho uma entidade que possui chave composta. Segui a linha do JPA, criei uma sub-entidade pra armazenar essa chave composta. Porém o VRaptor não consegue fazer a conversão, e lança a seguinte exceção:java.lang.IllegalArgumentException: Vraptor does not support this interface or abstract type: java.io.Serializable
at br.com.caelum.vraptor.http.ognl.GenericNullHandler.instantiate(GenericNullHandler.java:65)
at br.com.caelum.vraptor.http.ognl.ReflectionBasedNullHandler.nullPropertyValue(ReflectionBasedNullHandler.java:79)
at ognl.ASTProperty.getValueBody(ASTProperty.java:118)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
at ognl.SimpleNode.getValue(SimpleNode.java:236)
at ognl.ASTChain.setValueBody(ASTChain.java:222)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:279)
at ognl.Ognl.setValue(Ognl.java:737)
at ognl.Ognl.setValue(Ognl.java:783)
@Entity
public class OperationItem implements Identifiable<OperationItemPK> {
private static final long serialVersionUID = 1L;
@EmbeddedId
private OperationItemPK id;
@Version
private Long version;
@Column(nullable = false)
private Integer quantity;
//Getters e setters omitidos
}
@Embeddable
public class OperationItemPK implements Serializable{
private static final long serialVersionUID = 1L;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(nullable = false, name="material_id")
private Material material;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(nullable = false, name="operation_id")
private Operation operation;
public OperationItemPK() {}
/**
* @param material
* @param operation
*/
public OperationItemPK(final Material material, final Operation operation) {
this.material = material;
this.operation = operation;
}
//Getters e setters omitidos
}
public interface Identifiable<PK extends Serializable> extends Serializable {
public PK getId();
public void setId(final PK id);
}
@Convert(OperationItemPK.class)
@ApplicationScoped
public class OperationItemPKConverter implements Converter<OperationItemPK> {
/**
*
*/
public OperationItemPKConverter() {
System.out.println("OperationItemPKConverter.OperationItemPKConverter()");
}
/* (non-Javadoc)
* @see br.com.caelum.vraptor.Converter#convert(java.lang.String, java.lang.Class, java.util.ResourceBundle)
*/
@Override
public OperationItemPK convert(String value,
Class<? extends OperationItemPK> type, ResourceBundle bundle) {
System.out.println(value);
return null;
}
}
Alguma sugestão? Em último caso, vou adicionar acessores pros campos da PK diretamente na classe externa, fazendo delegação.
Atenciosamente.
