-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unexpected dirty checking behavior on collections of POJOs mapped wit…
…h JsonBinaryType #138
- Loading branch information
1 parent
921f1cc
commit 527c5ae
Showing
16 changed files
with
345 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...rc/test/java/com/vladmihalcea/hibernate/type/util/logging/InlineQueryLogEntryCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.vladmihalcea.hibernate.type.util.logging; | ||
|
||
import net.ttddyy.dsproxy.ExecutionInfo; | ||
import net.ttddyy.dsproxy.QueryInfo; | ||
import net.ttddyy.dsproxy.listener.DefaultQueryLogEntryCreator; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
* @author Vlad Mihalcea | ||
*/ | ||
public class InlineQueryLogEntryCreator extends DefaultQueryLogEntryCreator { | ||
@Override | ||
protected void writeParamsEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { | ||
sb.append("Params:["); | ||
for (QueryInfo queryInfo : queryInfoList) { | ||
boolean firstArg = true; | ||
for (Map<String, Object> paramMap : queryInfo.getQueryArgsList()) { | ||
|
||
if (!firstArg) { | ||
sb.append(", "); | ||
} else { | ||
firstArg = false; | ||
} | ||
|
||
SortedMap<String, Object> sortedParamMap = new TreeMap<String, Object>(new StringAsIntegerComparator()); | ||
sortedParamMap.putAll(paramMap); | ||
|
||
sb.append("("); | ||
boolean firstParam = true; | ||
for (Map.Entry<String, Object> paramEntry : sortedParamMap.entrySet()) { | ||
if (!firstParam) { | ||
sb.append(", "); | ||
} else { | ||
firstParam = false; | ||
} | ||
Object parameter = paramEntry.getValue(); | ||
if (parameter != null && parameter.getClass().isArray()) { | ||
sb.append(arrayToString(parameter)); | ||
} else { | ||
sb.append(parameter); | ||
} | ||
} | ||
sb.append(")"); | ||
} | ||
} | ||
sb.append("]"); | ||
} | ||
|
||
private String arrayToString(Object object) { | ||
if (object.getClass().isArray()) { | ||
if (object instanceof byte[]) { | ||
return Arrays.toString((byte[]) object); | ||
} | ||
if (object instanceof short[]) { | ||
return Arrays.toString((short[]) object); | ||
} | ||
if (object instanceof char[]) { | ||
return Arrays.toString((char[]) object); | ||
} | ||
if (object instanceof int[]) { | ||
return Arrays.toString((int[]) object); | ||
} | ||
if (object instanceof long[]) { | ||
return Arrays.toString((long[]) object); | ||
} | ||
if (object instanceof float[]) { | ||
return Arrays.toString((float[]) object); | ||
} | ||
if (object instanceof double[]) { | ||
return Arrays.toString((double[]) object); | ||
} | ||
if (object instanceof boolean[]) { | ||
return Arrays.toString((boolean[]) object); | ||
} | ||
if (object instanceof Object[]) { | ||
return Arrays.toString((Object[]) object); | ||
} | ||
} | ||
throw new UnsupportedOperationException("Array type not supported: " + object.getClass()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...rc/test/java/com/vladmihalcea/hibernate/type/util/logging/InlineQueryLogEntryCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.vladmihalcea.hibernate.type.util.logging; | ||
|
||
import net.ttddyy.dsproxy.ExecutionInfo; | ||
import net.ttddyy.dsproxy.QueryInfo; | ||
import net.ttddyy.dsproxy.listener.DefaultQueryLogEntryCreator; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
* @author Vlad Mihalcea | ||
*/ | ||
public class InlineQueryLogEntryCreator extends DefaultQueryLogEntryCreator { | ||
@Override | ||
protected void writeParamsEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { | ||
sb.append("Params:["); | ||
for (QueryInfo queryInfo : queryInfoList) { | ||
boolean firstArg = true; | ||
for (Map<String, Object> paramMap : queryInfo.getQueryArgsList()) { | ||
|
||
if (!firstArg) { | ||
sb.append(", "); | ||
} else { | ||
firstArg = false; | ||
} | ||
|
||
SortedMap<String, Object> sortedParamMap = new TreeMap<String, Object>(new StringAsIntegerComparator()); | ||
sortedParamMap.putAll(paramMap); | ||
|
||
sb.append("("); | ||
boolean firstParam = true; | ||
for (Map.Entry<String, Object> paramEntry : sortedParamMap.entrySet()) { | ||
if (!firstParam) { | ||
sb.append(", "); | ||
} else { | ||
firstParam = false; | ||
} | ||
Object parameter = paramEntry.getValue(); | ||
if (parameter != null && parameter.getClass().isArray()) { | ||
sb.append(arrayToString(parameter)); | ||
} else { | ||
sb.append(parameter); | ||
} | ||
} | ||
sb.append(")"); | ||
} | ||
} | ||
sb.append("]"); | ||
} | ||
|
||
private String arrayToString(Object object) { | ||
if (object.getClass().isArray()) { | ||
if (object instanceof byte[]) { | ||
return Arrays.toString((byte[]) object); | ||
} | ||
if (object instanceof short[]) { | ||
return Arrays.toString((short[]) object); | ||
} | ||
if (object instanceof char[]) { | ||
return Arrays.toString((char[]) object); | ||
} | ||
if (object instanceof int[]) { | ||
return Arrays.toString((int[]) object); | ||
} | ||
if (object instanceof long[]) { | ||
return Arrays.toString((long[]) object); | ||
} | ||
if (object instanceof float[]) { | ||
return Arrays.toString((float[]) object); | ||
} | ||
if (object instanceof double[]) { | ||
return Arrays.toString((double[]) object); | ||
} | ||
if (object instanceof boolean[]) { | ||
return Arrays.toString((boolean[]) object); | ||
} | ||
if (object instanceof Object[]) { | ||
return Arrays.toString((Object[]) object); | ||
} | ||
} | ||
throw new UnsupportedOperationException("Array type not supported: " + object.getClass()); | ||
} | ||
} |
Oops, something went wrong.