1 | public class ByteType extends PrimitiveType implements DiscriminatorType, VersionType {↵ | | 1 | public class IntegerType extends PrimitiveType implements DiscriminatorType, VersionType {↵
|
|
2 | private static final Byte ZERO = new Byte( (byte) 0 );↵ | | 2 | private static final Integer ZERO = new Integer(0);↵
|
|
3 | public Serializable getDefaultValue() {↵ | | 3 | public Serializable getDefaultValue() {↵
|
4 | return ZERO;↵ | | 4 | return ZERO;↵
|
5 | }↵ | | 5 | }↵
|
6 | ↵ | | 6 | ↵
|
7 | public Object get(ResultSet rs, String name) throws SQLException {↵ | | 7 | public Object get(ResultSet rs, String name) throws SQLException {↵
|
8 | return new Byte( rs.getByte(name) );↵ | | 8 | return new Integer( rs.getInt(name) );↵
|
9 | }↵ | | 9 | }↵
|
|
10 | public Class getPrimitiveClass() {↵ | | 10 | public Class getPrimitiveClass() {↵
|
11 | return byte.class;↵ | | 11 | return int.class;↵
|
12 | }↵ | | 12 | }↵
|
|
13 | public Class getReturnedClass() {↵ | | 13 | public Class getReturnedClass() {↵
|
14 | return Byte.class;↵ | | 14 | return Integer.class;↵
|
15 | }↵ | | 15 | }↵
|
|
16 | public void set(PreparedStatement st, Object value, int index) ↵ | | 16 | public void set(PreparedStatement st, Object value, int index)↵
|
17 | throws SQLException {↵ | | 17 | throws SQLException {↵
|
18 | st.setByte( index, ( (Byte) value ).byteValue() );↵ | | 18 | st.setInt( index, ( (Integer) value ).intValue() );↵
|
19 | }↵ | | 19 | }↵
|
|
20 | public int sqlType() {↵ | | 20 | public int sqlType() {↵
|
21 | return Types.TINYINT;↵ | | 21 | return Types.INTEGER;↵
|
22 | }↵ | | 22 | }↵
|
|
23 | public String getName() { return "byte"; }↵ | | 23 | public String getName() { return "integer"; }↵
|
|
24 | public String objectToSQLString(Object value, Dialect dialect) throws Exception {↵ | | 24 | public String objectToSQLString(Object value, Dialect dialect) throws Exception {↵
|
25 | return value.toString();↵ | | 25 | return value.toString();↵
|
26 | }↵ | | 26 | }↵
|
|
27 | public Object stringToObject(String xml) throws Exception {↵ | | 27 | public Object stringToObject(String xml) throws Exception {↵
|
28 | return new Byte(xml);↵ | | 28 | return new ↵
|
29 | }↵ | | |
|
|
30 | public Object fromStringValue(String xml) {↵ | | |
|
31 | return new Byte(xml);↵ | | 29 | Integer(xml);↵
|
32 | }↵ | | 30 | }↵
|
|
33 | public Object next(Object current, SessionImplementor session) {↵ | | 31 | public Object next(Object current, SessionImplementor session) {↵
|
34 | return new Byte( (byte) ( ( (Byte) current ).byteValue() + 1 ) );↵ | | 32 | return new Integer( ( (Integer) current ).intValue() + 1 );↵
|
35 | }↵ | | 33 | }↵
|
|
36 | public Object seed(SessionImplementor session) {↵ | | 34 | public Object seed(SessionImplementor session) {↵
|
37 | return ZERO;↵ | | 35 | return ZERO;↵
|
38 | }↵ | | 36 | }↵
|
|
39 | public Comparator getComparator() {↵ | | 37 | public Comparator getComparator() {↵
|
40 | return ComparableComparator.INSTANCE | | 38 | return ComparableComparator.INSTANCE;↵
|
| | | 39 | }↵
|
| | | 40 | ↵
|
| | | 41 | public Object fromStringValue(String xml) {↵
|
| | | 42 | return new Integer(xml)
|