本文整理汇总了Java中org.hibernate.type.Type.getColumnSpan方法的典型用法代码示例。如果您正苦于以下问题:Java Type.getColumnSpan方法的具体用法?Java Type.getColumnSpan怎么用?Java Type.getColumnSpan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.type.Type
的用法示例。
在下文中一共展示了Type.getColumnSpan方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getColumnCount
import org.hibernate.type.Type; //导入方法依赖的package包/类
/**
* Count the number of columns this projection uses.
*
* @param criteria The criteria
* @param criteriaQuery The query
*
* @return The number of columns
*/
public int getColumnCount(Criteria criteria, CriteriaQuery criteriaQuery) {
final Type[] types = getTypes( criteria, criteriaQuery );
int count = 0;
for ( Type type : types ) {
count += type.getColumnSpan( criteriaQuery.getFactory() );
}
return count;
}
示例2: getColumnSpan
import org.hibernate.type.Type; //导入方法依赖的package包/类
private int getColumnSpan(Type type, SessionFactoryImplementor sfi) {
int columnSpan = type.getColumnSpan( sfi );
if ( columnSpan == 0 && type instanceof OneToOneType ) {
columnSpan = ( (OneToOneType) type ).getIdentifierOrUniqueKeyType( sfi ).getColumnSpan( sfi );
}
return columnSpan;
}
示例3: initialize
import org.hibernate.type.Type; //导入方法依赖的package包/类
@Override
public void initialize() {
// TODO : this really needs to be delayed unitl after we definitively know the operand node type;
// where this is currently a problem is parameters for which where we cannot unequivocally
// resolve an expected type
Type operandType = extractDataType( getOperand() );
if ( operandType == null ) {
return;
}
SessionFactoryImplementor sessionFactory = getSessionFactoryHelper().getFactory();
int operandColumnSpan = operandType.getColumnSpan( sessionFactory );
if ( operandColumnSpan > 1 ) {
mutateRowValueConstructorSyntax( operandColumnSpan );
}
}
示例4: loadEntityIdByNaturalId
import org.hibernate.type.Type; //导入方法依赖的package包/类
@Override
public Serializable loadEntityIdByNaturalId(
Object[] naturalIdValues,
LockOptions lockOptions,
SessionImplementor session) {
if ( LOG.isTraceEnabled() ) {
LOG.tracef(
"Resolving natural-id [%s] to id : %s ",
naturalIdValues,
MessageHelper.infoString( this )
);
}
final boolean[] valueNullness = determineValueNullness( naturalIdValues );
final String sqlEntityIdByNaturalIdString = determinePkByNaturalIdQuery( valueNullness );
try {
PreparedStatement ps = session.getTransactionCoordinator()
.getJdbcCoordinator()
.getStatementPreparer()
.prepareStatement( sqlEntityIdByNaturalIdString );
try {
int positions = 1;
int loop = 0;
for ( int idPosition : getNaturalIdentifierProperties() ) {
final Object naturalIdValue = naturalIdValues[loop++];
if ( naturalIdValue != null ) {
final Type type = getPropertyTypes()[idPosition];
type.nullSafeSet( ps, naturalIdValue, positions, session );
positions += type.getColumnSpan( session.getFactory() );
}
}
ResultSet rs = session.getTransactionCoordinator().getJdbcCoordinator().getResultSetReturn().extract( ps );
try {
// if there is no resulting row, return null
if ( !rs.next() ) {
return null;
}
return (Serializable) getIdentifierType().hydrate( rs, getIdentifierAliases(), session, null );
}
finally {
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
}
}
finally {
session.getTransactionCoordinator().getJdbcCoordinator().release( ps );
}
}
catch ( SQLException e ) {
throw getFactory().getSQLExceptionHelper().convert(
e,
String.format(
"could not resolve natural-id [%s] to id : %s",
naturalIdValues,
MessageHelper.infoString( this )
),
sqlEntityIdByNaturalIdString
);
}
}
示例5: bind
import org.hibernate.type.Type; //导入方法依赖的package包/类
/**
* Bind the appropriate value into the given statement at the specified position.
*
* @param statement The statement into which the value should be bound.
* @param qp The defined values for the current query execution.
* @param session The session against which the current execution is occuring.
* @param position The position from which to start binding value(s).
*
* @return The number of sql bind positions "eaten" by this bind operation.
*/
@Override
public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position) throws SQLException {
Type type = qp.getPositionalParameterTypes()[hqlPosition];
Object value = qp.getPositionalParameterValues()[hqlPosition];
type.nullSafeSet( statement, value, position, session );
return type.getColumnSpan( session.getFactory() );
}
示例6: getColumnSpan
import org.hibernate.type.Type; //导入方法依赖的package包/类
/**
* Retrieve the number of columns represented by this type.
*
* @param type The type.
*
* @return The number of columns.
*/
public int getColumnSpan(Type type) {
return type.getColumnSpan( sfi );
}