Skip to content

Commit

Permalink
ListArrayType generates an extra UPDATE when persisting an entity vla…
Browse files Browse the repository at this point in the history
  • Loading branch information
vladmihalcea committed Feb 5, 2020
1 parent d96dd81 commit 878a472
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ public Object wrap(Object value, WrapperOptions options) {
return list;
}

@Override
public boolean areEqual(Object one, Object another) {
if (one == another) {
return true;
}
if (one == null || another == null) {
return false;
}
if(one instanceof Collection) {
one = ((Collection) one).toArray();
}
if(another instanceof Collection) {
another = ((Collection) another).toArray();
}

return ArrayUtil.isEquals(one, another);
}

@Override
public void setParameterValues(Properties parameters) {
Class entityClass = ReflectionUtils.getClass(parameters.getProperty(DynamicParameterizedType.ENTITY));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ public Object wrap(Object value, WrapperOptions options) {
return list;
}

@Override
public boolean areEqual(Object one, Object another) {
if (one == another) {
return true;
}
if (one == null || another == null) {
return false;
}
if(one instanceof Collection) {
one = ((Collection) one).toArray();
}
if(another instanceof Collection) {
another = ((Collection) another).toArray();
}

return ArrayUtil.isEquals(one, another);
}

@Override
public void setParameterValues(Properties parameters) {
Class entityClass = ReflectionUtils.getClass(parameters.getProperty(DynamicParameterizedType.ENTITY));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ public Object wrap(Object value, WrapperOptions options) {
return list;
}

@Override
public boolean areEqual(Object one, Object another) {
if (one == another) {
return true;
}
if (one == null || another == null) {
return false;
}
if(one instanceof Collection) {
one = ((Collection) one).toArray();
}
if(another instanceof Collection) {
another = ((Collection) another).toArray();
}

return ArrayUtil.isEquals(one, another);
}

@Override
public void setParameterValues(Properties parameters) {
Class entityClass = ReflectionUtils.getClass(parameters.getProperty(DynamicParameterizedType.ENTITY));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ public Object wrap(Object value, WrapperOptions options) {
return list;
}

@Override
public boolean areEqual(Object one, Object another) {
if (one == another) {
return true;
}
if (one == null || another == null) {
return false;
}
if(one instanceof Collection) {
one = ((Collection) one).toArray();
}
if(another instanceof Collection) {
another = ((Collection) another).toArray();
}

return ArrayUtil.isEquals(one, another);
}

@Override
public void setParameterValues(Properties parameters) {
Class entityClass = ReflectionUtils.getClass(parameters.getProperty(DynamicParameterizedType.ENTITY));
Expand Down

0 comments on commit 878a472

Please sign in to comment.