ebean-orm/avaje-ebeanorm-server — pull request #14 by Timshel (2013-04-10 16:53:08+00:00)
Title: Correction not to fail with an IllegalArgumentException when using find on an object with an enum as id.

In IdBinderSimple a call is made to convert the value to the bean type :

public void bindId(DataBind dataBind, Object value) throws SQLException {
value = scalarType.toBeanType(value);
idProperty.bind(dataBind, value);
}

The cal to toBeanType conflict when using an enum as an id because it'll try to convert something which is already a bean value, and failed with an IllegalArgumentException in EnumToDbValueMap when calling :

public Object getBeanValue(T dbValue) {
if (dbValue == null) {
return null;
}
Object beanValue = valueMap.get(dbValue);
if (beanValue == null && !allowNulls) {
String msg = "Bean value for " + dbValue + " not found in " + valueMap;
throw new IllegalArgumentException(msg);
}
return beanValue;
}

The change is just to check if we already have the correct bean type as done in convertSetId.

The patch was tested on the avaje-ebeanorm-server-3.1.2 tag but not on the master because i'am unable to compile at the time.