|
1 | 1 | package org.javawebstack.orm; |
2 | 2 |
|
3 | 3 | import org.javawebstack.orm.exception.ORMQueryException; |
| 4 | +import org.javawebstack.orm.mapper.DefaultMapper; |
4 | 5 | import org.javawebstack.orm.mapper.TypeMapper; |
5 | 6 |
|
6 | 7 | import java.lang.reflect.InvocationTargetException; |
7 | | -import java.sql.Date; |
8 | 8 | import java.sql.ResultSet; |
9 | 9 | import java.sql.SQLException; |
10 | | -import java.sql.Timestamp; |
11 | 10 | import java.util.ArrayList; |
12 | 11 | import java.util.HashMap; |
13 | 12 | import java.util.List; |
@@ -90,30 +89,10 @@ private static Object getValue(ResultSet rs, Class<?> sqlType, String tableName, |
90 | 89 | } catch (SQLException ex) { |
91 | 90 | return null; |
92 | 91 | } |
93 | | - if (sqlType.equals(String.class)) |
94 | | - return rs.getString(columnName); |
95 | | - if (sqlType.equals(Short.class)) |
96 | | - return rs.getShort(columnName); |
97 | | - if (sqlType.equals(Integer.class)) |
98 | | - return rs.getInt(columnName); |
99 | | - if (sqlType.equals(Boolean.class)) |
100 | | - return rs.getBoolean(columnName); |
101 | | - if (sqlType.equals(Long.class)) |
102 | | - return rs.getLong(columnName); |
103 | | - if (sqlType.equals(Double.class)) |
104 | | - return rs.getDouble(columnName); |
105 | | - if (sqlType.equals(Float.class)) |
106 | | - return rs.getFloat(columnName); |
107 | | - if (sqlType.equals(Timestamp.class)) |
108 | | - return rs.getTimestamp(columnName); |
109 | | - if (sqlType.equals(Date.class)) |
110 | | - return rs.getDate(columnName); |
111 | | - if (sqlType.equals(byte[].class)) |
112 | | - return rs.getBytes(columnName); |
| 92 | + return rs.getObject(columnName, DefaultMapper.TYPE_MAPPING); |
113 | 93 | } catch (SQLException e) { |
114 | 94 | throw new ORMQueryException(e); |
115 | 95 | } |
116 | | - return null; |
117 | 96 | } |
118 | 97 |
|
119 | 98 | private static <T extends Model> void setValue(Repo<T> repo, String fieldName, T entry, Object value) { |
|
0 commit comments