use of org.apache.cayenne.access.types.ExtendedType in project cayenne by apache.
the class JdbcAdapter method initExtendedTypes.
/**
* @since 3.1
*/
protected void initExtendedTypes(List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ValueObjectTypeRegistry valueObjectTypeRegistry) {
for (ExtendedType type : defaultExtendedTypes) {
extendedTypes.registerType(type);
}
// loading adapter specific extended types
configureExtendedTypes(extendedTypes);
for (ExtendedType type : userExtendedTypes) {
extendedTypes.registerType(type);
}
for (ExtendedTypeFactory typeFactory : extendedTypeFactories) {
extendedTypes.addFactory(typeFactory);
}
extendedTypes.addFactory(new ValueObjectTypeFactory(extendedTypes, valueObjectTypeRegistry));
}
use of org.apache.cayenne.access.types.ExtendedType in project cayenne by apache.
the class ProcedureAction method readProcedureOutParameters.
/**
* Helper method that reads OUT parameters of a CallableStatement.
*/
protected void readProcedureOutParameters(CallableStatement statement, OperationObserver delegate) throws SQLException, Exception {
long t1 = System.currentTimeMillis();
// build result row...
DataRow result = null;
List<ProcedureParameter> parameters = getProcedure().getCallParameters();
for (int i = 0; i < parameters.size(); i++) {
ProcedureParameter parameter = parameters.get(i);
if (!parameter.isOutParam()) {
continue;
}
if (result == null) {
result = new DataRow(2);
}
ColumnDescriptor descriptor = new ColumnDescriptor(parameter);
ExtendedType type = dataNode.getAdapter().getExtendedTypes().getRegisteredType(descriptor.getJavaClass());
Object val = type.materializeObject(statement, i + 1, descriptor.getJdbcType());
result.put(descriptor.getDataRowKey(), val);
}
if (result != null && !result.isEmpty()) {
// treat out parameters as a separate data row set
dataNode.getJdbcEventLogger().logSelectCount(1, System.currentTimeMillis() - t1);
delegate.nextRows(query, Collections.singletonList(result));
}
}
Aggregations