use of org.hibernate.type.AbstractSingleColumnStandardBasicType in project hibernate-orm by hibernate.
the class ModelBinder method resolveLob.
private void resolveLob(final SingularAttributeSourceBasic attributeSource, SimpleValue value) {
// Essentially this expects the type to map to a CLOB/NCLOB/BLOB sql type internally and compares.
if (!value.isLob() && value.getTypeName() != null) {
final TypeResolver typeResolver = attributeSource.getBuildingContext().getMetadataCollector().getTypeResolver();
final BasicType basicType = typeResolver.basic(value.getTypeName());
if (basicType instanceof AbstractSingleColumnStandardBasicType) {
if (isLob(((AbstractSingleColumnStandardBasicType) basicType).getSqlTypeDescriptor().getSqlType(), null)) {
value.makeLob();
}
}
}
// if this maps to CLOB/NCLOB/BLOB then the value will be marked as lob.
if (!value.isLob()) {
for (RelationalValueSource relationalValueSource : attributeSource.getRelationalValueSources()) {
if (ColumnSource.class.isInstance(relationalValueSource)) {
if (isLob(null, ((ColumnSource) relationalValueSource).getSqlType())) {
value.makeLob();
}
}
}
}
}
use of org.hibernate.type.AbstractSingleColumnStandardBasicType in project BroadleafCommerce by BroadleafCommerce.
the class GenericEntityDaoImpl method readGenericEntity.
@Override
public <T> T readGenericEntity(Class<T> clazz, Object id) {
clazz = (Class<T>) DynamicDaoHelperImpl.getNonProxyImplementationClassIfNecessary(clazz);
Map<String, Object> md = daoHelper.getIdMetadata(clazz, (HibernateEntityManager) em);
AbstractSingleColumnStandardBasicType type = (AbstractSingleColumnStandardBasicType) md.get("type");
if (type instanceof LongType) {
id = Long.parseLong(String.valueOf(id));
} else if (type instanceof IntegerType) {
id = Integer.parseInt(String.valueOf(id));
}
return em.find(clazz, id);
}
Aggregations