summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-09-21 23:38:21 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-09-21 23:38:21 +0000
commit6eb4085299e05ffe1cba38c658d8b24f12e3d0d7 (patch)
tree497e21c2b3737a757f4bec5c79bd05bb69824130 /src
parent9ac1b2a5ce32426615e7aecd4c18c113f79a15e3 (diff)
Fix support for char data type when used with an adapter.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java
index 3f71d1c..ad568d8 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java
@@ -1518,6 +1518,23 @@ class JDBCStorableGenerator<S extends Storable> {
toClass = com.amazon.carbonado.lob.Clob.class;
}
Method adaptMethod = adapter.findAdaptMethod(property.getType(), toClass);
+
+ if (adaptMethod == null) {
+ if (toClass == String.class) {
+ // Check if special case for converting character to String.
+ adaptMethod = adapter.findAdaptMethod(property.getType(), char.class);
+ if (adaptMethod == null) {
+ adaptMethod = adapter.findAdaptMethod
+ (property.getType(), Character.class);
+ }
+ }
+
+ if (adaptMethod == null) {
+ throw new SupportException
+ ("Unable to adapt " + property.getType() + " to " + toClass.getName());
+ }
+ }
+
TypeDesc adaptType = TypeDesc.forClass(adaptMethod.getReturnType());
if (mode != INITIAL_VERSION) {
// Invoke special inherited protected method that gets the field