/*
* Hibernate OGM, Domain model persistence for NoSQL datastores
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.ogm.type.impl;
import org.hibernate.MappingException;
import org.hibernate.engine.spi.Mapping;
import org.hibernate.ogm.type.descriptor.impl.StringMappedGridTypeDescriptor;
import org.hibernate.type.descriptor.java.ByteTypeDescriptor;
/**
* Persist a {@link Byte} as a {@link String}.
* TODO Could be better to persist as an {@link Integer}.
*
* @author Oliver Carr ocarr@redhat.com
*
*/
public class ByteStringType extends AbstractGenericBasicType<Byte> {
public static final ByteStringType INSTANCE = new ByteStringType();
public ByteStringType() {
super( StringMappedGridTypeDescriptor.INSTANCE, ByteTypeDescriptor.INSTANCE );
}
@Override
public String getName() {
return "byte_as_string";
}
@Override
public int getColumnSpan(Mapping mapping) throws MappingException {
return 1;
}
}