private void addNamedNativeQueryIfNeeded(NamedNativeQuery annotation, List<NamedNativeQuery> queries) { if ( annotation != null ) { String queryName = annotation.name(); boolean present = false; for ( NamedNativeQuery current : queries ) { if ( current.name().equals( queryName ) ) { present = true; break; } } if ( !present ) { queries.add( annotation ); } } }
name.setValue(query.name()); namedQuery.addMemberValue("name", name);
if ( queryAnn == null ) return; if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) { throw new AnnotationException( "A named query must have a name when used in class or package level" ); String queryName = queryAnn.query(); NamedSQLQueryDefinitionBuilder builder = new NamedSQLQueryDefinitionBuilder( queryAnn.name() ) .setQuery( queryName ) .setQuerySpaces( null ) LOG.debugf( "Binding named native query: %s => %s", queryAnn.name(), queryAnn.query() );
private void addNamedNativeQueryIfNeeded(NamedNativeQuery annotation, List<NamedNativeQuery> queries) { if ( annotation != null ) { String queryName = annotation.name(); boolean present = false; for (NamedNativeQuery current : queries) { if ( current.name().equals( queryName ) ) { present = true; break; } } if ( !present ) queries.add( annotation ); } }
public static void bindNativeQuery(NamedNativeQuery queryAnn, ExtendedMappings mappings, boolean isDefault) { if ( queryAnn == null ) return; if ( BinderHelper.isDefault( queryAnn.name() ) ) { throw new AnnotationException( "A named query must have a name when used in class or package level" ); mappings.addDefaultSQLQuery( queryAnn.name(), query ); mappings.addSQLQuery( queryAnn.name(), query ); log.info( "Binding named native query: {} => {}", queryAnn.name(), queryAnn.query() );
private boolean hasNamedNativeQuery(String query, NamedNativeQuery... queries) { for (NamedNativeQuery q : queries) { if (query.equals(q.name())) return true; } return false; }
private boolean hasNamedNativeQuery(String query, NamedNativeQuery... queries) { for (NamedNativeQuery q : queries) { if (query.equals(q.name())) return true; } return false; }
private boolean hasNamedNativeQuery(String query, NamedNativeQuery... queries) { for (NamedNativeQuery q : queries) { if (query.equals(q.name())) return true; } return false; }
private boolean hasNamedNativeQuery(String query, NamedNativeQuery... queries) { for (NamedNativeQuery q : queries) { if (query.equals(q.name())) return true; } return false; }
private boolean hasNamedNativeQuery(String query, NamedNativeQuery... queries) { for (NamedNativeQuery q : queries) { if (query.equals(q.name())) return true; } return false; }
private void addNamedNativeQueryIfNeeded(NamedNativeQuery annotation, List<NamedNativeQuery> queries) { if ( annotation != null ) { String queryName = annotation.name(); boolean present = false; for ( NamedNativeQuery current : queries ) { if ( current.name().equals( queryName ) ) { present = true; break; } } if ( !present ) { queries.add( annotation ); } } }
private void addNamedNativeQueryIfNeeded(NamedNativeQuery annotation, List<NamedNativeQuery> queries) { if ( annotation != null ) { String queryName = annotation.name(); boolean present = false; for ( NamedNativeQuery current : queries ) { if ( current.name().equals( queryName ) ) { present = true; break; } } if ( !present ) { queries.add( annotation ); } } }
private void addNamedNativeQueryIfNeeded(NamedNativeQuery annotation, List<NamedNativeQuery> queries) { if ( annotation != null ) { String queryName = annotation.name(); boolean present = false; for ( NamedNativeQuery current : queries ) { if ( current.name().equals( queryName ) ) { present = true; break; } } if ( !present ) { queries.add( annotation ); } } }
public <I extends BaseNature, A extends Annotation> boolean processAnnotation( final I info, final A annotation, final AnnotatedElement target) throws AnnotationTargetException { if ((info instanceof JPAClassNature) && (annotation instanceof NamedNativeQuery) && (target instanceof Class<?>) && (target.isAnnotationPresent(NamedNativeQuery.class))) { LOG.debug("Processing class annotation " + annotation.toString()); final JPAClassNature jpaClassNature = (JPAClassNature) info; final NamedNativeQuery namedNativeQuery = (NamedNativeQuery) annotation; final Map<String, String> namedNativeQueryMap = new HashMap<String,String>(); namedNativeQueryMap.put(namedNativeQuery.name(), namedNativeQuery.query()); jpaClassNature.setNamedNativeQuery(namedNativeQueryMap); return true; } return false; }
private NamedQueryInfo(NamedNativeQuery theQuery) { mName = theQuery.name(); mQuery = theQuery.query(); mResultMapping = theQuery.resultSetMapping(); mResultClass = theQuery.resultClass(); mHints = Arrays.asList(theQuery.hints()); }
/** * @param locator * the locator * @param annotation * the annotation * * @since 2.0.0 */ public NamedNativeQueryMetadataImpl(AbstractLocator locator, NamedNativeQuery annotation) { super(); this.locator = locator; this.name = annotation.name(); this.query = annotation.query(); this.resultClass = annotation.resultClass().getName(); this.resultSetMapping = annotation.resultSetMapping(); for (final QueryHint hint : annotation.hints()) { this.hints.put(hint.name(), hint.value()); } }
/** * @param locator * the locator * @param annotation * the annotation * * @since 2.0.0 */ public NamedNativeQueryMetadataImpl(AbstractLocator locator, NamedNativeQuery annotation) { super(); this.locator = locator; this.name = annotation.name(); this.query = annotation.query(); this.resultClass = annotation.resultClass().getName(); this.resultSetMapping = annotation.resultSetMapping(); for (final QueryHint hint : annotation.hints()) { this.hints.put(hint.name(), hint.value()); } }
/** * INTERNAL: */ public MetadataNamedNativeQuery(NamedNativeQuery namedNativeQuery, Class javaClass) { // Set the location where we found this query. setLocation(javaClass.getName()); // Process the name setName(namedNativeQuery.name()); // Process the query string. setEJBQLString(namedNativeQuery.query()); // Process the query hints. for (QueryHint hint : namedNativeQuery.hints()) { addHint(new MetadataQueryHint(hint.name(), hint.value())); } // Process the result class. setResultClass(namedNativeQuery.resultClass()); // Process the result set mapping. setResultSetMapping(namedNativeQuery.resultSetMapping()); }