Skip to content

Commit

Permalink
[playframework#1304] Binder does not check if id field is null
Browse files Browse the repository at this point in the history
  • Loading branch information
pepite committed Dec 12, 2011
1 parent 29dea1d commit 2bb3801
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/src/play/db/jpa/JPAPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public Object bind(RootParamNode rootParamNode, String name, Class clazz, java.l
Class[] pk = new JPAModelLoader(clazz).keyTypes();
int j = 0;
for (ParamNode id : ids) {
if (id.getValues() == null || id.getValues().length == 0) {
// We have no ids, it is a new entity
if (id.getValues() == null || id.getValues().length == 0 || id.getFirstValue(null)== null || id.getFirstValue(null).trim().length() <= 0 ) {
// We have no ids, it is a new entity
return GenericModel.create(rootParamNode, name, clazz, annotations);
}
query.setParameter(j + 1, Binder.directBind(id.getOriginalKey(), annotations, id.getValues()[0], pk[j++], null));
Expand Down

0 comments on commit 2bb3801

Please sign in to comment.