How to temporarily disable read-only 2nd level cache hibernate strategy in Grails ?

Posted by fabien7474 on Stack Overflow See other posts from Stack Overflow or by fabien7474
Published on 2010-02-10T16:58:31Z Indexed on 2010/05/01 0:47 UTC
Read the original article Hit count: 402

In my grails application, some of my domain classes will never be changed by Users.

However, some maintenance work is sometimes necessary, and administrator should be able to create/edit few instances from time to time (let's say twice a year).

I would like to set a read-only 2nd level cache strategy for these domain classes (static mapping = { cache usage: 'read-only' } ) AND I would like to be able to 'disable' (in very particular situations) the read-only strategy in order to udate some instances via Grails scaffolding edit view.

Is it possible? What do you advise me to do?

EDIT: The solution I am implementing is a mix of Pascal and Burt answers (see comments). Both answers are great and helpful. So I got a dilemna for choosing the accepted answer! Anyway, thank you.

© Stack Overflow or respective owner

Related posts about grails

Related posts about hibernate