summaryrefslogtreecommitdiffstats
path: root/das-java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java
index 0e5fc48c0c..6e02b3dbbc 100644
--- a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java
+++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java
@@ -23,6 +23,7 @@ import java.util.Iterator;
import java.util.Map;
import org.apache.log4j.Logger;
+import org.apache.tuscany.sdo.util.DataObjectUtil;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
@@ -101,8 +102,16 @@ public final class DataObjectMaker {
}
Object value = tableData.getColumnData(propertyName);
-
- obj.set(p, value);
+ try {
+ obj.set(p, value);
+ } catch (ClassCastException e) {
+ // a mismatch between the value and property types may happen in some cases
+ // e.g. when the property is a boolean but the database doesn't have a boolean data type
+ if (value != null) {
+ Object convertedValue = DataObjectUtil.getSetValue(p, value.toString());
+ obj.set(p, convertedValue);
+ }
+ }
}
return obj;