类javax.persistence.NamedStoredProcedureQuery源码实例Demo

下面列出了怎么用javax.persistence.NamedStoredProcedureQuery的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: JPAOverriddenAnnotationReader.java
private NamedStoredProcedureQueries getNamedStoredProcedureQueries(Element tree, XMLContext.Default defaults) {
	List<NamedStoredProcedureQuery> queries = buildNamedStoreProcedureQueries( tree, defaults, classLoaderAccess );
	if ( defaults.canUseJavaAnnotations() ) {
		NamedStoredProcedureQuery annotation = getPhysicalAnnotation( NamedStoredProcedureQuery.class );
		addNamedStoredProcedureQueryIfNeeded( annotation, queries );
		NamedStoredProcedureQueries annotations = getPhysicalAnnotation( NamedStoredProcedureQueries.class );
		if ( annotations != null ) {
			for ( NamedStoredProcedureQuery current : annotations.value() ) {
				addNamedStoredProcedureQueryIfNeeded( current, queries );
			}
		}
	}
	if ( queries.size() > 0 ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( NamedStoredProcedureQueries.class );
		ad.setValue( "value", queries.toArray( new NamedStoredProcedureQuery[queries.size()] ) );
		return AnnotationFactory.create( ad );
	}
	else {
		return null;
	}
}
 
源代码2 项目: lams   文件: NamedProcedureCallDefinition.java
NamedProcedureCallDefinition(NamedStoredProcedureQuery annotation) {
	this.registeredName = annotation.name();
	this.procedureName = annotation.procedureName();
	this.hints = new QueryHintDefinition( annotation.hints() ).getHintsMap();
	this.resultClasses = annotation.resultClasses();
	this.resultSetMappings = annotation.resultSetMappings();

	this.parameterDefinitions = new ParameterDefinitions( annotation.parameters(), hints );

	final boolean specifiesResultClasses = resultClasses != null && resultClasses.length > 0;
	final boolean specifiesResultSetMappings = resultSetMappings != null && resultSetMappings.length > 0;

	if ( specifiesResultClasses && specifiesResultSetMappings ) {
		throw new MappingException(
				String.format(
						"NamedStoredProcedureQuery [%s] specified both resultClasses and resultSetMappings",
						registeredName
				)
		);
	}
}
 
源代码3 项目: lams   文件: QueryBinder.java
public static void bindNamedStoredProcedureQuery(
		NamedStoredProcedureQuery annotation,
		MetadataBuildingContext context,
		boolean isDefault) {
	if ( annotation == null ) {
		return;
	}

	if ( BinderHelper.isEmptyAnnotationValue( annotation.name() ) ) {
		throw new AnnotationException( "A named query must have a name when used in class or package level" );
	}

	final NamedProcedureCallDefinition def = new NamedProcedureCallDefinition( annotation );

	if (isDefault) {
		context.getMetadataCollector().addDefaultNamedProcedureCallDefinition( def );
	}
	else {
		context.getMetadataCollector().addNamedProcedureCallDefinition( def );
	}
	LOG.debugf( "Bound named stored procedure query : %s => %s", def.getRegisteredName(), def.getProcedureName() );
}
 
源代码4 项目: lams   文件: AnnotationBinder.java
private static void bindNamedStoredProcedureQueries(NamedStoredProcedureQueries annotation, MetadataBuildingContext context, boolean isDefault) {
	if ( annotation != null ) {
		for ( NamedStoredProcedureQuery queryAnnotation : annotation.value() ) {
			bindNamedStoredProcedureQuery( queryAnnotation, context, isDefault );
		}
	}
}
 
源代码5 项目: lams   文件: JPAOverriddenAnnotationReader.java
private void addNamedStoredProcedureQueryIfNeeded(NamedStoredProcedureQuery annotation, List<NamedStoredProcedureQuery> queries) {
	if ( annotation != null ) {
		String queryName = annotation.name();
		boolean present = false;
		for ( NamedStoredProcedureQuery current : queries ) {
			if ( current.name().equals( queryName ) ) {
				present = true;
				break;
			}
		}
		if ( !present ) {
			queries.add( annotation );
		}
	}
}
 
源代码6 项目: lams   文件: AnnotationBinder.java
private static void bindNamedStoredProcedureQuery(NamedStoredProcedureQuery annotation, MetadataBuildingContext context, boolean isDefault) {
	if ( annotation != null ) {
		QueryBinder.bindNamedStoredProcedureQuery( annotation, context, isDefault );
	}
}
 
 类所在包
 类方法
 同包方法