diff --git a/onebusaway-gtfs-hibernate/pom.xml b/onebusaway-gtfs-hibernate/pom.xml index d82a6f173..2b33ab06a 100644 --- a/onebusaway-gtfs-hibernate/pom.xml +++ b/onebusaway-gtfs-hibernate/pom.xml @@ -21,7 +21,7 @@ org.hibernate hibernate-core - 3.3.1.GA + 5.1.0.Final diff --git a/onebusaway-gtfs-hibernate/src/main/java/org/onebusaway/gtfs/impl/ServiceDateUserType.java b/onebusaway-gtfs-hibernate/src/main/java/org/onebusaway/gtfs/impl/ServiceDateUserType.java index 4416f7a94..21e76f452 100644 --- a/onebusaway-gtfs-hibernate/src/main/java/org/onebusaway/gtfs/impl/ServiceDateUserType.java +++ b/onebusaway-gtfs-hibernate/src/main/java/org/onebusaway/gtfs/impl/ServiceDateUserType.java @@ -24,6 +24,7 @@ import java.text.ParseException; import org.hibernate.HibernateException; +import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.usertype.UserType; import org.onebusaway.gtfs.model.calendar.ServiceDate; @@ -64,34 +65,34 @@ public Object deepCopy(Object value) throws HibernateException { return new ServiceDate((ServiceDate) value); } - @Override - public Object nullSafeGet(ResultSet rs, String[] names, Object owner) - throws HibernateException, SQLException { - - String value = rs.getString(names[0]); - - if (rs.wasNull()) - return null; - - try { - return ServiceDate.parseString(value); - } catch (ParseException ex) { - throw new SQLException("error parsing service date value: " + value, ex); - } - } - - @Override - public void nullSafeSet(PreparedStatement st, Object value, int index) - throws HibernateException, SQLException { - - if (value == null) { - st.setNull(index, SQL_TYPES[0]); - } else { - ServiceDate serviceDate = (ServiceDate) value; - st.setString(index, serviceDate.getAsString()); - } - } - + @Override + public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) + throws HibernateException, SQLException { + + String value = rs.getString(names[0]); + + if (rs.wasNull()) + return null; + + try { + return ServiceDate.parseString(value); + } catch (ParseException ex) { + throw new SQLException("error parsing service date value: " + value, ex); + } + } + + @Override + public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) + throws HibernateException, SQLException { + + if (value == null) { + st.setNull(index, SQL_TYPES[0]); + } else { + ServiceDate serviceDate = (ServiceDate) value; + st.setString(index, serviceDate.getAsString()); + } + } + @Override public Object assemble(Serializable cached, Object owner) throws HibernateException { @@ -110,4 +111,5 @@ public Object replace(Object original, Object target, Object owner) return null; return deepCopy(original); } + }