All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.joutvhu.dynamic.jdbc.DynamicQuery Maven / Gradle / Ivy

Go to download

The Spring Dynamic JDBC will make it easy to implement dynamic queries with Spring Data JDBC

There is a newer version: 3.0.1
Show newest version
package com.joutvhu.dynamic.jdbc;

import org.springframework.data.annotation.QueryAnnotation;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation to declare finder dynamic queries directly on repository methods.
 *
 * @author Giao Ho
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@QueryAnnotation
@Documented
public @interface DynamicQuery {
    /**
     * Provides a query template method name, which is used to find external query templates.
     * The default is {@code entityName:methodName}, entityName is entity class name, methodName is query method name.
     *
     * @return the query template method name
     * @since x.x.1
     */
    String name() default "";

    /**
     * Defines the query template to be executed when the annotated method is called.
     */
    String value() default "";

    /**
     * Optional {@link RowMapper} to use to convert the result of the query to domain class instances. Cannot be used
     * along with {@link #resultSetExtractorClass()} only one of the two can be set.
     */
    Class rowMapperClass() default RowMapper.class;

    /**
     * Optional {@link ResultSetExtractor} to use to convert the result of the query to domain class instances. Cannot be
     * used along with {@link #rowMapperClass()} only one of the two can be set.
     */
    Class resultSetExtractorClass() default ResultSetExtractor.class;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy