Values return to the client in a proxy object should be converted to the proper type.
This commit is contained in:
parent
007b6a51ae
commit
602e3521b4
2 changed files with 10 additions and 2 deletions
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>net.helenus</groupId>
|
<groupId>net.helenus</groupId>
|
||||||
<artifactId>helenus-core</artifactId>
|
<artifactId>helenus-core</artifactId>
|
||||||
<version>2.0.19-SNAPSHOT</version>
|
<version>2.0.20-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>helenus</name>
|
<name>helenus</name>
|
||||||
|
|
|
@ -34,6 +34,7 @@ import net.helenus.support.HelenusException;
|
||||||
import net.helenus.support.HelenusMappingException;
|
import net.helenus.support.HelenusMappingException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
public final class InsertOperation<T> extends AbstractOperation<T, InsertOperation<T>> {
|
public final class InsertOperation<T> extends AbstractOperation<T, InsertOperation<T>> {
|
||||||
|
|
||||||
|
@ -153,7 +154,14 @@ public final class InsertOperation<T> extends AbstractOperation<T, InsertOperati
|
||||||
// Then, fill in all the rest of the properties.
|
// Then, fill in all the rest of the properties.
|
||||||
for (HelenusProperty prop : properties) {
|
for (HelenusProperty prop : properties) {
|
||||||
String key = prop.getPropertyName();
|
String key = prop.getPropertyName();
|
||||||
if (!backingMap.containsKey(key)) {
|
if (backingMap.containsKey(key)) {
|
||||||
|
// Some values man need to be converted (e.g. from String to Enum). This is done
|
||||||
|
// within the BeanColumnValueProvider below.
|
||||||
|
Optional<Function<Object, Object>> converter = prop.getReadConverter(sessionOps.getSessionRepository());
|
||||||
|
if (converter.isPresent()) {
|
||||||
|
backingMap.put(key, converter.get().apply(backingMap.get(key)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// If we started this operation with an instance of this type, use values from that.
|
// If we started this operation with an instance of this type, use values from that.
|
||||||
if (pojo != null) {
|
if (pojo != null) {
|
||||||
backingMap.put(key, BeanColumnValueProvider.INSTANCE.getColumnValue(pojo, -1, prop));
|
backingMap.put(key, BeanColumnValueProvider.INSTANCE.getColumnValue(pojo, -1, prop));
|
||||||
|
|
Loading…
Reference in a new issue