javax.persistence.StoredProcedureParameter Java Examples

The following examples show how to use javax.persistence.StoredProcedureParameter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NamedProcedureCallDefinition.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
ParameterDefinitions(StoredProcedureParameter[] parameters, Map<String, Object> queryHintMap) {
	if ( parameters == null || parameters.length == 0 ) {
		parameterStrategy = ParameterStrategy.POSITIONAL;
		parameterDefinitions = new ParameterDefinition[0];
	}
	else {
		parameterStrategy = StringHelper.isNotEmpty( parameters[0].name() )
				? ParameterStrategy.NAMED
				: ParameterStrategy.POSITIONAL;
		parameterDefinitions = new ParameterDefinition[ parameters.length ];

		for ( int i = 0; i < parameters.length; i++ ) {
			parameterDefinitions[i] = ParameterDefinition.from(
					parameterStrategy,
					parameters[i],
					// i+1 for the position because the apis say the numbers are 1-based, not zero
					i+1,
					queryHintMap
			);
		}
	}
}
 
Example #2
Source File: NamedProcedureCallDefinition.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
static ParameterDefinition from(
		ParameterStrategy parameterStrategy,
		StoredProcedureParameter parameterAnnotation,
		int adjustedPosition,
		Map<String, Object> queryHintMap) {
	// see if there was an explicit hint for this parameter in regards to NULL passing
	final Object explicitNullPassingHint;
	if ( parameterStrategy == ParameterStrategy.NAMED ) {
		explicitNullPassingHint = queryHintMap.get( AvailableSettings.PROCEDURE_NULL_PARAM_PASSING + '.' + parameterAnnotation.name() );
	}
	else {
		explicitNullPassingHint = queryHintMap.get( AvailableSettings.PROCEDURE_NULL_PARAM_PASSING + '.' + adjustedPosition );
	}

	return new ParameterDefinition(
			adjustedPosition,
			parameterAnnotation,
			interpretBoolean( explicitNullPassingHint )
	);
}
 
Example #3
Source File: NamedProcedureCallDefinition.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
ParameterDefinition(int position, StoredProcedureParameter annotation, Boolean explicitPassNullSetting) {
	this.position = position;
	this.name = normalize( annotation.name() );
	this.parameterMode = annotation.mode();
	this.type = annotation.type();
	this.explicitPassNullSetting = explicitPassNullSetting;
}