So, I have a JPA project, running on JBoss 4.2.3, and I just recently wired up JBossCache as the 2nd level cache for it.
Everything ran smoothly, 'til I tried to optimize a bit.
Then I hit issues. I have a 'Campaign' object with a 'Nodes' collection and a 'Connectors' each mapped as a one-to-many relationship. Works fine, even with caching. I have each collection set up in its own cache region.
Then I put the @BatchSize annotation on the collections and all hell breaks loose. Suddenly I start getting errors like this:
org.hibernate.cache.CacheException: org.jboss.cache.lock.TimeoutException failure acquiring lock: fqn=/, caller=Thread[ajp-###.###.###.###- ####-7,5,jboss], lock=read owners=[GlobalTransaction:<###.###.###.###:####>:18] (org.jboss.cache.lock.LockStrategySerializable@6c9d476e)
What it looks like to me is that each collection when it went to batch, tried to lock the appropriate cache region, and failed, puking since I have 'Serializable' isolation set. So why the 'fqn=/' if my cache region is 'campaign/nodes' for one collection and 'campaign/connectors' on the other?
The moment I take the @BatchSize annotation off, or the @Cache annotation off, everything's happy.
Similarly, I'm trying to use the query cache. A simple criteria query to pull back a campaign by a non-PK UID, I'm putting under cache region "query/campaignByUID" and a user query (used to poll to see if the user has permissions to view the campaign) also a criteria query, under cache region "query/userByUsername".
But when I try to execute these two queries in the same transaction, I get the exact same blow-uppage. 'fqn=/' despite my quite explicitly set cache regions. I turn off the query cache, or make either query un-cacheable and we're happy again.
I'm a veteran Hibernate user, but haven't had luck with the 2nd level caches yet. And I haven't really needed them much in the past. This is a different story, and eventually I gotta get this working. I'm sure I'll figure it out, but any of you experts out there than can lend a hand, I'd appreciate it.
Please let me know if I can provide more useful info. Stack traces, code, configs, etc.
Thanks in advance.
-Falken
|