1 | public class ByteType extends PrimitiveType implements DiscriminatorType, VersionType {↵ | | 1 | public class ShortType extends PrimitiveType implements DiscriminatorType, VersionType {↵
|
|
2 | private static final Byte ZERO = new Byte( (byte) 0 );↵ | | 2 | private static final Short ZERO = new Short( (short) 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 Short( rs.getShort(name) );↵
|
9 | }↵ | | 9 | }↵
|
|
10 | public Class getPrimitiveClass() {↵ | | 10 | public Class getPrimitiveClass() {↵
|
11 | return byte.class;↵ | | 11 | return short.class;↵
|
12 | }↵ | | 12 | }↵
|
|
13 | public Class getReturnedClass() {↵ | | 13 | public Class getReturnedClass() {↵
|
14 | return Byte.class;↵ | | 14 | return Short.class;↵
|
15 | }↵ | | 15 | }↵
|
|
16 | public void set(PreparedStatement st, Object value, int index) throws SQLException {↵ | | 16 | public void set(PreparedStatement st, Object value, int index) throws SQLException {↵
|
17 | st.setByte( index, ( (Byte) value ).byteValue() );↵ | | 17 | st.setShort( index, ( (Short) value ).shortValue() );↵
|
18 | }↵ | | 18 | }↵
|
|
19 | public int sqlType() {↵ | | 19 | public int sqlType() {↵
|
20 | return Types.TINYINT;↵ | | 20 | return Types.SMALLINT;↵
|
21 | }↵ | | 21 | }↵
|
|
22 | public String getName() { return "byte"; }↵ | | 22 | public String getName() { return "short"; }↵
|
|
23 | public String objectToSQLString(Object value, Dialect dialect) throws Exception {↵ | | 23 | public String objectToSQLString(Object value, Dialect dialect) throws Exception {↵
|
24 | return value.toString();↵ | | 24 | return value.toString();↵
|
25 | }↵ | | 25 | }↵
|
|
26 | public Object stringToObject(String xml) throws Exception {↵ | | 26 | public Object stringToObject(String xml) throws Exception {↵
|
27 | return new Byte(xml);↵ | | 27 | return new ↵
|
28 | }↵ | | |
|
|
29 | public Object fromStringValue(String xml) {↵ | | |
|
30 | return new Byte(xml);↵ | | 28 | Short(xml);↵
|
31 | }↵ | | 29 | }↵
|
|
32 | public Object next(Object current, SessionImplementor session) {↵ | | 30 | public Object next(Object current, SessionImplementor session) {↵
|
33 | return new Byte( (byte) ( ( (Byte) current ).byteValue() + 1 ) );↵ | | 31 | return new Short( (short) ( ( (Short) current ).shortValue() + 1 ) );↵
|
34 | }↵ | | 32 | }↵
|
|
35 | public Object seed(SessionImplementor session) {↵ | | 33 | public Object seed(SessionImplementor session) {↵
|
36 | return ZERO;↵ | | 34 | return ZERO;↵
|
37 | }↵ | | 35 | }↵
|
|
38 | public Comparator getComparator() {↵ | | 36 | public Comparator getComparator() {↵
|
39 | return ComparableComparator.INSTANCE;↵ | | 37 | return ComparableComparator.INSTANCE;↵
|
40 | | | 38 | }↵
|
| | | 39 | ↵
|
| | | 40 | public Object fromStringValue(String xml) {↵
|
| | | 41 | return new Short(xml);↵
|
| | | 42 |
|