Class ResourceSqlQueryResolver

  • All Implemented Interfaces:
    SqlQueryResolver, org.springframework.core.Ordered

    public class ResourceSqlQueryResolver
    extends AbstractCachingSqlQueryResolver
    implements org.springframework.core.Ordered
    Simple implementation of SqlQueryResolver resolving sql queries using Spring's generic ResourceLoader mechanism.
    Since:
    2.0.0
    Author:
    Marcel Overdijk, Paul Klos
    • Field Detail

      • DEFAULT_CHARSET

        public static final Charset DEFAULT_CHARSET
        Default charset for retrieving sql query resources (UTF_8).
    • Constructor Detail

      • ResourceSqlQueryResolver

        public ResourceSqlQueryResolver()
      • ResourceSqlQueryResolver

        public ResourceSqlQueryResolver​(org.springframework.core.io.ResourceLoader resourceLoader)
    • Method Detail

      • getCharset

        public Charset getCharset()
        Return the Charset for retrieving sql query resources.
      • setCharset

        public void setCharset​(Charset charset)
        Set the Charset for retrieving sql query resources.
      • getPrefix

        protected String getPrefix()
        Return the prefix that gets prepended to sql query names when building the resource location.
      • setPrefix

        public void setPrefix​(String prefix)
        Set the prefix that gets prepended to sql query names when building the resource location.
      • getSuffix

        protected String getSuffix()
        Return the suffix that gets appended to sql query names when building the resource location.
      • setSuffix

        public void setSuffix​(String suffix)
        Set the suffix that gets appended to sql query names when building the resource location.
      • getOrder

        public int getOrder()
        Return the order in which this SqlQueryResolver is evaluated.
        Specified by:
        getOrder in interface org.springframework.core.Ordered
      • setOrder

        public void setOrder​(int order)
        Set the order in which this SqlQueryResolver is evaluated.
      • doRefreshQueryHolder

        protected void doRefreshQueryHolder​(String sqlQueryName,
                                            AbstractCachingSqlQueryResolver.QueryHolder queryHolder)
        Description copied from class: AbstractCachingSqlQueryResolver
        Subclasses may override this method to implement their own expiry mechanism. The default implementation does nothing, i.e. once a query is cached it will never be updated.

        This method is only called when the current thread has a lock on the QueryHolder, so subclasses need not deal with thread-safety.

        Overrides:
        doRefreshQueryHolder in class AbstractCachingSqlQueryResolver
        Parameters:
        sqlQueryName - the name of the query to refresh
        queryHolder - the cached QueryHolder to check