В итоге я написал собственный класс:
@Entity
public class FInterval {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private long id;
@Column
private long startMillis;
@Column
private long endMillis;
public FInterval() {
}
public long getStartMillis() {
return startMillis;
}
public void setStartMillis(long start) {
this.startMillis = start;
}
public long getEndMillis() {
return endMillis;
}
public void setEndMillis(long end) {
this.endMillis = end;
}
public FInterval(Interval entity) {
this.startMillis = entity.getStartMillis();
this.endMillis = entity.getEndMillis();
}
public Interval getInterval() {
return new Interval(this.startMillis,this.endMillis);
}
}
и конвертер атрибутов:
@Converter(autoApply = true)
public class IntervalAttributeConverter implements AttributeConverter<Interval, FInterval> {
@Override
public FInterval convertToDatabaseColumn(Interval attribute) {
return new FInterval(attribute);
}
@Override
public Interval convertToEntityAttribute(FInterval dbData) {
return dbData.getInterval();
}
}