queryString.setValue(query.query()); namedQuery.addMemberValue("query", queryString);
String resultSetMapping = queryAnn.resultSetMapping(); QueryHint[] hints = queryAnn.hints(); String queryName = queryAnn.query(); if ( !BinderHelper.isDefault( resultSetMapping ) ) { mappings.addSQLQuery( queryAnn.name(), query ); log.info( "Binding named native query: {} => {}", queryAnn.name(), queryAnn.query() );
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; }
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 NamedNativeQueries) && (target instanceof Class<?>) && (target.isAnnotationPresent(NamedNativeQueries.class))) { LOG.debug("Processing class annotation " + annotation.toString()); final JPAClassNature jpaClassNature = (JPAClassNature) info; final NamedNativeQueries namedNativeQueries = (NamedNativeQueries) annotation; final NamedNativeQuery[] namedNativeQueryValues = namedNativeQueries .value(); final Map<String, String> namedNativeQueryMap = new HashMap<String, String>(); if (namedNativeQueryValues != null && namedNativeQueryValues.length > 0) { for (NamedNativeQuery query : namedNativeQueryValues) { namedNativeQueryMap.put(query.name(), query.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()); } }
/** * @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()); }
nativeQueryConfig.setQuery(namedNativeQueryAnn.query()); nativeQueryConfig.setResultClass(namedNativeQueryAnn.resultClass()); nativeQueryConfig.setResultSetMapping(namedNativeQueryAnn.resultSetMapping());
throw new MetaDataException(_loc.get("no-native-query-name", el)); if (StringUtils.isEmpty(query.query())) throw new MetaDataException(_loc.get("no-native-query-string", query.name(), el)); meta.setQueryString(query.query()); meta.setLanguage(QueryLanguages.LANG_SQL); Class res = query.resultClass();
throw new MetaDataException(_loc.get("no-native-query-name", el)); if (StringUtils.isEmpty(query.query())) throw new MetaDataException(_loc.get("no-native-query-string", query.name(), el)); meta.setQueryString(query.query()); Class<?> res = query.resultClass(); if (ImplHelper.isManagedType(getConfiguration(), res))
throw new MetaDataException(_loc.get("no-native-query-name", el)); if (StringUtils.isEmpty(query.query())) throw new MetaDataException(_loc.get("no-native-query-string", query.name(), el)); meta.setQueryString(query.query()); Class<?> res = query.resultClass(); if (ImplHelper.isManagedType(getConfiguration(), res))
throw new MetaDataException(_loc.get("no-native-query-name", el)); if (StringUtil.isEmpty(query.query())) throw new MetaDataException(_loc.get("no-native-query-string", query.name(), el)); meta.setQueryString(query.query()); Class<?> res = query.resultClass(); if (ImplHelper.isManagedType(getConfiguration(), res))
throw new MetaDataException(_loc.get("no-native-query-name", el)); if (StringUtil.isEmpty(query.query())) throw new MetaDataException(_loc.get("no-native-query-string", query.name(), el)); meta.setQueryString(query.query()); Class<?> res = query.resultClass(); if (ImplHelper.isManagedType(getConfiguration(), res))
final String sqlString = queryAnn.query();