HHH-18881 Implement fromEncodedString as inverse of appendEncodedString

This commit is contained in:
Čedomir Igaly 2024-11-26 18:45:44 +01:00 committed by Christian Beikov
parent a93e8e6e20
commit 8b517c50f3
1 changed files with 1 additions and 2 deletions

View File

@ -24,7 +24,6 @@ import org.hibernate.HibernateException;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.sql.ast.spi.SqlAppender;
import org.hibernate.type.descriptor.DateTimeUtils;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
@ -224,7 +223,7 @@ public class JdbcTimestampJavaType extends AbstractTemporalJavaType<Date> implem
@Override
public Date fromEncodedString(CharSequence charSequence, int start, int end) {
try {
final TemporalAccessor accessor = DateTimeUtils.DATE_TIME.parse( subSequence( charSequence, start, end ) );
final TemporalAccessor accessor = ENCODED_FORMATTER.parse( subSequence( charSequence, start, end ) );
final Timestamp timestamp;
if ( accessor.isSupported( ChronoField.INSTANT_SECONDS ) ) {
timestamp = new Timestamp( accessor.getLong( ChronoField.INSTANT_SECONDS ) * 1000L );