public void addQueryToCollection(String queryName, String query, boolean isNativeQuery, Class clazz)
    {
        if (namedNativeQueries == null)
        {
            namedNativeQueries = new ConcurrentHashMap<String, QueryWrapper>();
        }
        if (!namedNativeQueries.containsKey(queryName))
        {
            namedNativeQueries.put(queryName, new QueryWrapper(queryName, query, isNativeQuery, clazz));
        }
        // No null check made as it will never hold null value
        else if (queryName != null && !getQuery(queryName).equals(query))
        {
            logger.error("Duplicate named/native query with name:" + queryName
                    + "found! Already there is a query with same name:" + namedNativeQueries.get(queryName));
            throw new ApplicationLoaderException("Duplicate named/native query with name:" + queryName
                    + "found! Already there is a query with same name:" + namedNativeQueries.get(queryName));
        }
    }
public void addQueryToCollection ( String queryName , String query , boolean isNativeQuery , Class clazz ) { if ( namedNativeQueries == null ) { namedNativeQueries = new ConcurrentHashMap < String , QueryWrapper > ( ) ; } if ( ! namedNativeQueries . containsKey ( queryName ) ) { namedNativeQueries . put ( queryName , new QueryWrapper ( queryName , query , isNativeQuery , clazz ) ) ; } else if ( queryName != null && ! getQuery ( queryName ) . equals ( query ) ) { logger . error ( "Duplicate named/native query with name:" + queryName + "found! Already there is a query with same name:" + namedNativeQueries . get ( queryName ) ) ; throw new ApplicationLoaderException ( "Duplicate named/native query with name:" + queryName + "found! Already there is a query with same name:" + namedNativeQueries . get ( queryName ) ) ; } }
Adds parameterised query with given name into collection. Throws
exception if duplicate name is provided.

@param queryName
query name.
@param query
named/native query.
@param isNativeQuery
true, if it is a namednativequery.