io.github.greennlab.ddul.entity.BooleanToCharYNConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ddul Show documentation
Show all versions of ddul Show documentation
DDul means "ground" in korean prounance.
It helps to you when concreate a java projects.
And support with database access, cache abstraction, system code generation,
hierarchical data handling, article management and etc.
package io.github.greennlab.ddul.entity;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
@Converter(autoApply = true)
@SuppressWarnings("unused")
public class BooleanToCharYNConverter
implements AttributeConverter {
@Override
public Character convertToDatabaseColumn(Boolean attribute) {
return attribute == null || !attribute ? 'N' : 'Y';
}
@Override
public Boolean convertToEntityAttribute(Character dbData) {
return dbData != null && dbData == 'Y';
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy