List of usage examples for org.hibernate.type StandardBasicTypes TIMESTAMP
TimestampType TIMESTAMP
To view the source code for org.hibernate.type StandardBasicTypes TIMESTAMP.
Click Source Link
From source file:org.joda.time.contrib.hibernate.PersistentDateTimeTZ.java
License:Apache License
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, null, index, session); StandardBasicTypes.STRING.nullSafeSet(statement, null, index + 1, session); } else {//w w w.j ava 2 s.co m DateTime dt = (DateTime) value; StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, dt.toDate(), index, session); StandardBasicTypes.STRING.nullSafeSet(statement, dt.getZone().getID(), index + 1, session); } }
From source file:org.joda.time.contrib.hibernate.PersistentInstant.java
License:Apache License
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { Object value = StandardBasicTypes.TIMESTAMP.nullSafeGet(rs, names[0], session, owner); if (value == null) { return null; }/*from w w w. java 2 s . co m*/ return new Instant(value); }
From source file:org.joda.time.contrib.hibernate.PersistentInstant.java
License:Apache License
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, null, index, session); } else {//from w ww .ja v a 2 s. c o m StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, ((Instant) value).toDate(), index, session); } }
From source file:org.joda.time.contrib.hibernate.PersistentInterval.java
License:Apache License
private DateTime nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner) throws HibernateException, SQLException { Object timestamp = StandardBasicTypes.TIMESTAMP.nullSafeGet(rs, name, session, owner); if (timestamp == null) { return null; }//from ww w . j a va 2 s . co m return new DateTime(timestamp); }
From source file:org.joda.time.contrib.hibernate.PersistentInterval.java
License:Apache License
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { statement.setNull(index, StandardBasicTypes.TIMESTAMP.sqlType()); statement.setNull(index + 1, StandardBasicTypes.TIMESTAMP.sqlType()); return;/*from www . jav a 2 s . c om*/ } Interval interval = (Interval) value; statement.setTimestamp(index, asTimeStamp(interval.getStart())); statement.setTimestamp(index + 1, asTimeStamp(interval.getEnd())); }
From source file:org.joda.time.contrib.hibernate.PersistentLocalDateTime.java
License:Apache License
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { Object timestamp = StandardBasicTypes.TIMESTAMP.nullSafeGet(rs, names[0], session, owner); if (timestamp == null) { return null; }//www . ja va 2s . c om return new LocalDateTime(timestamp); }
From source file:org.joda.time.contrib.hibernate.PersistentLocalDateTime.java
License:Apache License
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, null, index, session); } else {/* www . j av a 2 s. com*/ StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, ((LocalDateTime) value).toDateTime().toDate(), index, session); } }
From source file:org.joda.time.contrib.hibernate.PersistentLocalTimeAsTimestamp.java
License:Apache License
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { Object timestamp = StandardBasicTypes.TIMESTAMP.nullSafeGet(rs, names[0], session, owner); if (timestamp == null) { return null; }/*from ww w . j a va 2 s . c om*/ return new LocalTime(timestamp, DateTimeZone.UTC); }
From source file:org.joda.time.contrib.hibernate.PersistentLocalTimeAsTimestamp.java
License:Apache License
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, null, index, session); } else {/*from www . ja v a2 s . c o m*/ LocalTime lt = ((LocalTime) value); Timestamp timestamp = new Timestamp(lt.getMillisOfDay()); StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, timestamp, index, session); } }
From source file:org.ng200.openolympus.OpenOlympusPostgreDialect.java
License:Open Source License
public OpenOlympusPostgreDialect() { super();//from ww w . ja va 2 s. c o m this.registerFunction("add_time", new SQLFunctionTemplate(StandardBasicTypes.TIMESTAMP, "?1 + ?2 * INTERVAL '1 MILLISECOND'")); }