-
1. Re: JBoss 4.2.1 Optimistic Locking - how to turn on
peterj Jul 27, 2009 10:47 AM (in response to smith.gerry)There are two possibilities here. First, your database supports optimistic locking in which case you can specify that in your *-ds.xml file. Second, you are using Hibernate for persistence in which case it uses optimistic locking by default unless you can set the optimistic-lock mapping attribute to false. You can read more about optimistic-lock in the Hibernate docs.
-
2. Re: JBoss 4.2.1 Optimistic Locking - how to turn on
smith.gerry Jul 27, 2009 2:20 PM (in response to smith.gerry)Many thanks for the reply.
I'm using mysql.
So all I have to do is edit the datasource to make the cache use optimistic locking ? I probably should have said I meant in the cache ?
Thanks,
Gerry Smith -
3. Re: JBoss 4.2.1 Optimistic Locking - how to turn on
peterj Jul 27, 2009 3:27 PM (in response to smith.gerry)Which data provider are you using in MySQL? I know that InnoDB does not provide optimistic locking?
Cache? Nothing like throwing in yet another term. What cache are you thinking about? Are you perhaps thinking of the caching that Hibernate does, since Hibernate is used to implement JPA?
The datasource does not do any caching (except for perhaps prepared statements, but that is really being done by the database anyway). JBoss AS does maintain a connection pool of data sources, but that does not involve caching any data. -
4. Re: JBoss 4.2.1 Optimistic Locking - how to turn on
smith.gerry Jul 27, 2009 4:01 PM (in response to smith.gerry)I was referring to JBoss cache, I think I need to do something like this:
http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/cache/Tree_Cache_Guide/Configuration-Sample_XML_Based_Configuration.html
Thanks again,
Gerry Smith -
5. Re: JBoss 4.2.1 Optimistic Locking - how to turn on
smith.gerry Jul 27, 2009 4:04 PM (in response to smith.gerry)- or upgrade to 5.1 and use MVCC, but I had other problems upgrading the app to 5.0.
(obviously I'm getting deadlocks with pessimistic locking)
Gerry Smith