Java 类javax.persistence.NamedQueries 实例源码

项目:lams    文件:JPAOverriddenAnnotationReader.java   
private NamedQueries getNamedQueries(Element tree, XMLContext.Default defaults) {
    //TODO avoid the Proxy Creation (@NamedQueries) when possible
    List<NamedQuery> queries = (List<NamedQuery>) buildNamedQueries( tree, false, defaults );
    if ( defaults.canUseJavaAnnotations() ) {
        NamedQuery annotation = getPhysicalAnnotation( NamedQuery.class );
        addNamedQueryIfNeeded( annotation, queries );
        NamedQueries annotations = getPhysicalAnnotation( NamedQueries.class );
        if ( annotations != null ) {
            for ( NamedQuery current : annotations.value() ) {
                addNamedQueryIfNeeded( current, queries );
            }
        }
    }
    if ( queries.size() > 0 ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( NamedQueries.class );
        ad.setValue( "value", queries.toArray( new NamedQuery[queries.size()] ) );
        return AnnotationFactory.create( ad );
    }
    else {
        return null;
    }
}
项目:hyperjaxb3    文件:CreateXAnnotations.java   
public XAnnotation<?> createNamedQueries(
        Collection<NamedQuery> cNamedQueries) {
    return transform(
            NamedQueries.class,
            javax.persistence.NamedQuery.class,
            cNamedQueries,
            new Transformer<NamedQuery, XAnnotation<javax.persistence.NamedQuery>>() {
                public XAnnotation<javax.persistence.NamedQuery> transform(
                        NamedQuery input) {
                    return createNamedQuery(input);
                }
            });
}
项目:query    文件:Reflection.java   
public String getQueryString(String namedQueryName) {
    NamedQueries namedQueries = (NamedQueries) entityClass.getAnnotation(NamedQueries.class);
    for (NamedQuery namedQuery : namedQueries.value()) {
        if (namedQuery.name().equals(namedQueryName)) return namedQuery.query();
    }
    throw new QueryException("Named query " + namedQueryName + " not found in class " + entityClass.getName());
}
项目:lams    文件:QueryBinder.java   
public static void bindQueries(NamedQueries queriesAnn, Mappings mappings, boolean isDefault) {
    if ( queriesAnn == null ) return;
    for (NamedQuery q : queriesAnn.value()) {
        bindQuery( q, mappings, isDefault );
    }
}
项目:lams    文件:QueryBinder.java   
public static void bindQueries(org.hibernate.annotations.NamedQueries queriesAnn, Mappings mappings) {
    if ( queriesAnn == null ) return;
    for (org.hibernate.annotations.NamedQuery q : queriesAnn.value()) {
        bindQuery( q, mappings );
    }
}