Revision f1a25720
Added by Katja Luther over 6 years ago
- ID f1a25720755daa96e8838a617a660dfced7b9f31
- Parent 23e50194
cdmlib-model/src/main/java/eu/etaxonomy/cdm/hibernate/DOIUserType.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 |
*/ |
... | ... | |
17 | 17 |
|
18 | 18 |
import org.apache.log4j.Logger; |
19 | 19 |
import org.hibernate.HibernateException; |
20 |
import org.hibernate.engine.spi.SessionImplementor;
|
|
20 |
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|
21 | 21 |
import org.hibernate.type.StandardBasicTypes; |
22 | 22 |
import org.hibernate.usertype.UserType; |
23 | 23 |
import org.jadira.usertype.dateandtime.shared.spi.AbstractUserType; |
... | ... | |
42 | 42 |
if (o == null) { |
43 | 43 |
return null; |
44 | 44 |
} |
45 |
|
|
45 |
|
|
46 | 46 |
DOI doi = (DOI) o; |
47 | 47 |
|
48 | 48 |
try { |
... | ... | |
64 | 64 |
} |
65 | 65 |
|
66 | 66 |
@Override |
67 |
public DOI nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
|
67 |
public DOI nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
|
68 | 68 |
throws HibernateException, SQLException { |
69 | 69 |
String val = (String) StandardBasicTypes.STRING.nullSafeGet(rs, names, session, owner); |
70 |
|
|
70 |
|
|
71 | 71 |
if(val == null) { |
72 | 72 |
return null; |
73 | 73 |
} else { |
... | ... | |
81 | 81 |
} |
82 | 82 |
|
83 | 83 |
@Override |
84 |
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session)
|
|
84 |
public void nullSafeSet(PreparedStatement statement, Object value, int index, SharedSessionContractImplementor session)
|
|
85 | 85 |
throws HibernateException, SQLException { |
86 |
if (value == null) {
|
|
86 |
if (value == null) { |
|
87 | 87 |
StandardBasicTypes.STRING.nullSafeSet(statement, value, index, session); |
88 |
} else {
|
|
88 |
} else { |
|
89 | 89 |
DOI doi = (DOI)value; |
90 | 90 |
StandardBasicTypes.STRING.nullSafeSet(statement, doi.toString(), index, session); |
91 | 91 |
} |
... | ... | |
101 | 101 |
return SQL_TYPES; |
102 | 102 |
} |
103 | 103 |
|
104 |
|
|
104 |
|
|
105 | 105 |
|
106 | 106 |
|
107 | 107 |
|
Also available in: Unified diff
first implementation for change from joda time to java8 time