Revision 63228380
Added by Andreas Müller almost 9 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/hibernate/EnumUserType.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
43 | 43 |
private static final long serialVersionUID = 4641078915907621907L; |
44 | 44 |
@SuppressWarnings("unused") |
45 | 45 |
private static final Logger logger = Logger.getLogger(EnumUserType.class); |
46 |
|
|
47 |
private Class<E> clazz = null;
|
|
48 |
|
|
49 |
public EnumUserType(){};
|
|
50 |
|
|
51 |
public EnumUserType(Class<E> c) {
|
|
52 |
this.clazz = c;
|
|
53 |
}
|
|
54 |
|
|
46 |
|
|
47 |
private Class<E> clazz = null; |
|
48 |
|
|
49 |
public EnumUserType(){} |
|
50 |
|
|
51 |
public EnumUserType(Class<E> c) { |
|
52 |
this.clazz = c; |
|
53 |
} |
|
54 |
|
|
55 | 55 |
|
56 | 56 |
@Override |
57 | 57 |
@SuppressWarnings("unchecked") |
... | ... | |
62 | 62 |
throw new RuntimeException(e); |
63 | 63 |
} |
64 | 64 |
} |
65 |
|
|
65 |
|
|
66 | 66 |
private static final int[] SQL_TYPES = { Types.VARCHAR }; |
67 | 67 |
|
68 | 68 |
|
... | ... | |
77 | 77 |
} |
78 | 78 |
|
79 | 79 |
@Override |
80 |
public IKeyTerm nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
|
80 |
public IKeyTerm nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) |
|
81 | 81 |
throws HibernateException, SQLException { |
82 | 82 |
String val = (String) StandardBasicTypes.STRING.nullSafeGet(rs, names, session, owner); |
83 |
|
|
83 |
|
|
84 | 84 |
if(val == null) { |
85 | 85 |
return null; |
86 | 86 |
} else { |
... | ... | |
112 | 112 |
} |
113 | 113 |
|
114 | 114 |
@Override |
115 |
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session)
|
|
115 |
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session) |
|
116 | 116 |
throws HibernateException, SQLException { |
117 |
if (value == null) {
|
|
117 |
if (value == null) { |
|
118 | 118 |
StandardBasicTypes.STRING.nullSafeSet(statement, value, index, session); |
119 |
} else {
|
|
119 |
} else { |
|
120 | 120 |
IKeyTerm term = (IKeyTerm)value; |
121 | 121 |
StandardBasicTypes.STRING.nullSafeSet(statement, term.getKey(), index, session); |
122 | 122 |
} |
Also available in: Unified diff
more getters/adders, update script, vocabulary and test vocabulary for TaxonNodeAgentRelation #3583