Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.squareup.JooqTest;
- import java.sql.Timestamp;
- import java.time.Instant;
- import org.jooq.Converter;
- public class TimestampConverter implements Converter<Timestamp, Integer> {
- @Override public Integer from(Timestamp timestamp) {
- return (int)timestamp.toInstant().getEpochSecond();
- }
- @Override public Timestamp to(Integer value) {
- return Timestamp.from(Instant.ofEpochSecond(value));
- }
- @Override public Class<Timestamp> fromType() {
- return Timestamp.class;
- }
- @Override public Class<Integer> toType() {
- return Integer.class;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement