From 6eb4085299e05ffe1cba38c658d8b24f12e3d0d7 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Fri, 21 Sep 2007 23:38:21 +0000 Subject: Fix support for char data type when used with an adapter. --- .../carbonado/repo/jdbc/JDBCStorableGenerator.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/main/java/com/amazon/carbonado') 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 { 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 -- cgit v1.2.3