项目:lams
文件:JPAOverriddenAnnotationReader.java
private NamedStoredProcedureQueries getNamedStoredProcedureQueries(Element tree,XMLContext.Default defaults) {
List<NamedStoredProcedureQuery> queries = buildNamedStoreProcedureQueries( tree,defaults );
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;
}
}
NamedProcedureCallDeFinition(NamedStoredProcedureQuery annotation) {
this.registeredname = annotation.name();
this.procedureName = annotation.procedureName();
this.resultClasses = annotation.resultClasses();
this.resultSetMappings = annotation.resultSetMappings();
this.parameterDeFinitions = new ParameterDeFinitions( annotation.parameters() );
this.hints = new QueryHintDeFinition( annotation.hints() ).getHintsMap();
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
)
);
}
}
项目:lams
文件:QueryBinder.java
public static void bindNamedStoredProcedureQuery(NamedStoredProcedureQuery annotation,Mappings mappings,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){
mappings.addDefaultNamedProcedureCallDeFinition( def );
} else{
mappings.addNamedProcedureCallDeFinition( def );
}
LOG.debugf( "Bound named stored procedure query : %s => %s",def.getRegisteredname(),def.getProcedureName() );
}
项目:lams
文件:AnnotationBinder.java
private static void bindNamedStoredProcedureQueries(Mappings mappings,NamedStoredProcedureQueries annotation,boolean isDefault) {
if ( annotation != null ) {
for ( NamedStoredProcedureQuery queryAnnotation : annotation.value() ) {
bindNamedStoredProcedureQuery( mappings,queryAnnotation,isDefault );
}
}
}
项目: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 );
}
}
}
项目:lams
文件:AnnotationBinder.java
private static void bindNamedStoredProcedureQuery(Mappings mappings,NamedStoredProcedureQuery annotation,boolean isDefault) {
if ( annotation != null ) {
QueryBinder.bindNamedStoredProcedureQuery( annotation,mappings,isDefault );
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。