下面列出了怎么用org.hibernate.type.AbstractSingleColumnStandardBasicType的API类实例代码及写法,或者点击链接到github查看源代码。
private void resolveLob(final SingularAttributeSourceBasic attributeSource, SimpleValue value) {
// Resolves whether the property is LOB based on the type attribute on the attribute property source.
// 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 the prior check didn't set the lob flag, this will inspect the column sql-type attribute value and
// 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();
}
}
}
}
}
public void setParameterValues(Properties parameters) {
@SuppressWarnings("unchecked")
final AbstractSingleColumnStandardBasicType<? extends Object> heuristicType = (AbstractSingleColumnStandardBasicType<? extends Object>) new TypeResolver().heuristicType(identifierType.getName(), parameters);
if (heuristicType == null) {
throw new HibernateException("Unsupported identifier type " + identifierType.getName());
}
type = heuristicType;
sqlTypes = new int[]{ type.sqlType() };
}
protected AbstractSingleColumnStandardBasicType<?> getType() {
return type;
}