mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
add an additional day to make sure the timestamp fits in all timezones (#1239)
This commit is contained in:
@@ -15,9 +15,6 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class Feed extends AbstractModel {
|
||||
|
||||
// mariadb timestamp range starts at 1970-01-01 00:00:01
|
||||
public static final Instant MINIMUM_DISABLED_UNTIL = Instant.EPOCH.plusSeconds(1);
|
||||
|
||||
/**
|
||||
* The url of the feed
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
package com.commafeed.backend.model;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
public class Models {
|
||||
|
||||
public static final Instant MINIMUM_INSTANT = Instant.EPOCH
|
||||
// mariadb timestamp range starts at 1970-01-01 00:00:01
|
||||
.plusSeconds(1)
|
||||
// make sure the timestamp fits for all timezones
|
||||
.plus(Duration.ofHours(24));
|
||||
|
||||
/**
|
||||
* initialize a proxy
|
||||
*/
|
||||
@@ -18,8 +30,8 @@ public class Models {
|
||||
* extract the id from the proxy without initializing it
|
||||
*/
|
||||
public static Long getId(AbstractModel model) {
|
||||
if (model instanceof HibernateProxy) {
|
||||
LazyInitializer lazyInitializer = ((HibernateProxy) model).getHibernateLazyInitializer();
|
||||
if (model instanceof HibernateProxy proxy) {
|
||||
LazyInitializer lazyInitializer = proxy.getHibernateLazyInitializer();
|
||||
if (lazyInitializer.isUninitialized()) {
|
||||
return (Long) lazyInitializer.getIdentifier();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user