Skip to content

Commit 962ccc8

Browse files
committed
Allow conversion from OffsetDateTime to java.sql.Timestamp
1 parent 23a88d5 commit 962ccc8

File tree

1 file changed

+3
-0
lines changed
  • foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper

1 file changed

+3
-0
lines changed

foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/helper/ConversionManager.java

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import java.sql.Timestamp;
4444
import java.time.Instant;
4545
import java.time.LocalDateTime;
46+
import java.time.OffsetDateTime;
4647
import java.time.Year;
4748
import java.time.ZoneId;
4849
import java.time.ZoneOffset;
@@ -838,6 +839,8 @@ protected java.sql.Timestamp convertObjectToTimestamp(Object sourceObject) throw
838839
timestamp = Helper.timestampFromLong((Long)sourceObject);
839840
} else if (sourceObject instanceof LocalDateTime) {
840841
timestamp = Timestamp.valueOf((LocalDateTime) sourceObject);
842+
} else if (sourceObject instanceof OffsetDateTime) {
843+
timestamp = Timestamp.valueOf(((OffsetDateTime)sourceObject).toLocalDateTime());
841844
} else {
842845
throw ConversionException.couldNotBeConverted(sourceObject, ClassConstants.TIMESTAMP);
843846
}

0 commit comments

Comments
 (0)