Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Force query to db and not use cache

I have no experience with spring, but this works in JEE5:

public class JpaUtils {

    /**
     * Makes q ignore the cache.
     * @param q the query that has to go straight to the DB.
     * @return q the query that will go to the db now
     */
    public static Query noCache( Query q ) {
        // /!\ Eclipselink specific. Should make the em go straight to the DB.
        q.setHint("org.eclipse.persistence.config.CacheUsage", "DoNotCheckCache");
        return q;
    }

}


On Mon, May 31, 2010 at 8:26 AM, Stephiems <stephanie@xxxxxxxxxxxxxx> wrote:

I've done a search through this forum and tried just about everything I've
found on here from query hints to the cache annotation and properties in the
persistence.xml file and I cannot force a particular entity to go to the
database every time.

I have a table that is updated by an outside source every day, and I want to
force going to the database everytime to pick up any changes. No matter what
I do it doesn't go to the database the second time.

I'm wondering if it is the transaction, or possibly the fact I'm using
spring, that is causing it. Anyone else have this issue?

Cheers,
Stephanie
--
View this message in context: http://old.nabble.com/Force-query-to-db-and-not-use-cache-tp28726862p28726862.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top