org.hibernate.type.ZoneOffsetType Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core-jakarta Show documentation
Show all versions of hibernate-core-jakarta Show documentation
Hibernate O/RM implementation of the Jakarta Persistence specification
The newest version!
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.type;
import org.hibernate.dialect.Dialect;
import org.hibernate.type.descriptor.java.ZoneOffsetJavaDescriptor;
import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
import java.time.ZoneOffset;
/**
* A type mapping {@link java.sql.Types#VARCHAR VARCHAR} and {@link ZoneOffset}
*
* @author Gavin King
* @author Steve Ebersole
*/
public class ZoneOffsetType
extends AbstractSingleColumnStandardBasicType
implements LiteralType {
public static final ZoneOffsetType INSTANCE = new ZoneOffsetType();
public ZoneOffsetType() {
super( VarcharTypeDescriptor.INSTANCE, ZoneOffsetJavaDescriptor.INSTANCE );
}
public String getName() {
return ZoneOffset.class.getSimpleName();
}
@Override
protected boolean registerUnderJavaType() {
return true;
}
public String objectToSQLString(ZoneOffset value, Dialect dialect) throws Exception {
return StringType.INSTANCE.objectToSQLString( value.getId(), dialect );
}
}