+ Start a Discussion

Getting around Governor Limits (with @ReadOnly)

I'm planning to build a Visualforce page with a lot of different apex:components.


Some components are going to be a Select(Count) of certain records, which may be over 50,000.   To get around the governor limit restrictions, I was thinking of using the @ReadOnly annotation/page mode, as it increases the limits to 1 million and I'm not performing DML with this Count.


However, in another, unrelated component on the same page I will be displaying a Datatable with much fewer records (around 20) with DML Operations.  I figure that if I make the whole page Read-only, I will not be able to perform this DML. It seems that both work without the other, but put together they don't.


Is there a way to make certain components/controllers Read-Only and others not?  I read that you can use @ReadOnly as a class annotation but that a) This was only available as a webservice, and b) The docs say "if a Visualforcepage calls a Web service that contains the@ReadOnly

annotation, the request fails because Visualforce is the top level request, not the Web service" which is basically what I was planning on doing.


Is there any workaround for this?