I could explain your behaviour if your isolation level was not repetable read but a less strict one like read committed or read uncommitted. Repeatable read will always do a read for update and thus not very efficient for your scenario. Sounds like there's some other issue.
Hibernate 2.11 - rather old, I don't know it at all and you might find that's where your problem lies. On Wed, May 28, 2008 at 1:49 PM, Ryan Meder <[EMAIL PROTECTED]> wrote: > Hi > > > I had a look and it seems like we our transaction isolation level is set to > TRANSACTION_REPEATABLE_READ, which is the default. We are using MySQL 5 with > Hibernate 2.1.1, by the way. Considering the options that are available, > which one do you think would work best: > > TRANSACTION_READ_UNCOMMITTED / TRANSACTION_READ_COMMITTED / > TRANSACTION_SERIALIZABLE. > > Or do we need to try all of them and see what happens (doesn't sound very > scientific :) ? > > > We disabled the transactional cache because we thought that may be the > problem, or at least we are getting the error whether we have one specified > or not. Considering the options below in the properties file, would there be > any specific one you think is best, or would any of them work? > #hibernate.cache.provider_class net.sf.hibernate.cache.TreeCacheProvider > #hibernate.cache.provider_class net.sf.ehcache.hibernate.Provider > > #hibernate.cache.provider_class net.sf.hibernate.cache.HashtableCacheProvider > #hibernate.cache.provider_class net.sf.hibernate.cache.OSCacheProvider > #hibernate.cache.provider_class net.sf.hibernate.cache.JCSCacheProvider > #hibernate.cache.provider_class net.sf.hibernate.cache.SwarmCacheProvider > > Thanks for your input and effort so far! > > > > > 2008/5/28 Michael Wiles <[EMAIL PROTECTED]>: > >> It sounds like your transaction isolation is not set correctly for the >> kind of processing you require. It's set on the datasource and it controls >> the isolation level between transactions. It sounds like you've got >> simultaneous transactions running and the results of one transaction are not >> being seen by another for transactions start before another has finished. >> >> You might want adjust that and see if it helps. You might also want to try >> a cache which supports transactions. i.e. a transactional cache. There are >> few in hibernate which are transaction aware, and for the kind of behaviour >> you're wanting, it sounds like that the only kind of cache that's going to >> work. >> >> On Fri, May 23, 2008 at 11:10 AM, Ryan Meder <[EMAIL PROTECTED]> wrote: >> >>> Hi All, >>> >>> >>> Sorry to reply late but we still having problems with hibernate, i am not >>> the most experienced and based on your responses i am sure you guys will be >>> able to help. :) >>> >>> >>> We are using the threadlocal way of storing a session. The problem however >>> seems to have appeared with the introduction of Ajax into the system and >>> specifically on screens >>> >>> that have multiple requests running in the background, often running >>> queries on properties on the same objects that we may be displaying or >>> editing on the main browser screen. >>> >>> We suspect that this may be causing some locking errors or "confusing" >>> hibernate in some way. We have disabled second level cache just to rule >>> that out but the problem persists, so: >>> >>> >>> 1.) Would hibernate have probs accessing the same objects from different >>> threads/sessions? >>> 2.) What is the best way to use hibernate in situations like this? >>> >>> Thanks alot >>> >>> >>> Ryan >>> >>> 2008/4/20 Bruce Lowe <[EMAIL PROTECTED]>: >>> >>>> Gary may be right - its a common problem. which is why with >>>> Bi-directional relationships i make a method in the Entity object to add to >>>> both sides. >>>> >>>> Another possible cause for the problem u are having is if you are using >>>> the threadlocal way of storing a session. Tomcat caches threads, so >>>> sometimes ull find when u refresh the browser u may get stale data since >>>> tomcat choose to use a cached thread with cached hiberante data. This can >>>> lead to what appears to be wierd cache issues. To solve this use you can >>>> try a Filter in tomcat to start and close every hibernate session. >>>> >>>> >>>> >>>> On Sat, Apr 19, 2008 at 11:21 PM, Michael Wiles < >>>> [EMAIL PROTECTED]> wrote: >>>> >>>>> Does it work fine when you have no 2nd level cache? >>>>> >>>>> If so, what Gary said is the first place to look. It is very easy to >>>>> forget to set the forward references (they're not required if you have no >>>>> cache because only the back reference is necessary to establish the >>>>> relationship on the db). >>>>> >>>>> Why do you say "hibernate is not committing transactions between >>>>> requests to the web server? What is the symptom of this? Is it because the >>>>> data is wrong on the front end or on the database? >>>>> >>>>> On Fri, Apr 18, 2008 at 5:59 PM, Gary Jacobson <[EMAIL PROTECTED]> >>>>> wrote: >>>>> >>>>>> I've had a similar problem using Glassfish which made me tear my hair >>>>>> out for a while. I eventually discovered that the cause was 2 entities >>>>>> that >>>>>> pointed to each other. e.g. Company.employeeList mapped by >>>>>> Employee.company. >>>>>> When I added an employee to the company, I was setting employee.company, >>>>>> and >>>>>> it saved it to the database correctly, but I wasn't adding the employee >>>>>> to >>>>>> the company.employeeList, and the data being displayed was from the >>>>>> cached >>>>>> Company entity. >>>>>> >>>>>> >>>>>> On Fri, Apr 18, 2008 at 1:18 PM, Ryan Meder <[EMAIL PROTECTED]> wrote: >>>>>> >>>>>>> Hi Guys, >>>>>>> >>>>>>> >>>>>>> >>>>>>> I am hoping you can shed some light (for EskomJ) regarding a >>>>>>> Hibernate problem that we are all of a sudden experiencing. We have >>>>>>> never >>>>>>> had any issues in the past and been continually developing. We are busy >>>>>>> testing our development and currently Hibernate is not committing >>>>>>> transactions between requests to the web server. This does not happen >>>>>>> all >>>>>>> the time but when ever hibernate feels like not doing its job properly. >>>>>>> >>>>>>> >>>>>>> >>>>>>> This leaves us with a problem where incorrect data is being displayed >>>>>>> to the browser when it has been committed to the db in a previous >>>>>>> transaction. We are thinking that the problem could be with the >>>>>>> first or second level cache. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Our second level cache provider is >>>>>>> "net.sf.hibernate.cache.TreeCacheProvider". >>>>>>> >>>>>>> >>>>>>> >>>>>>> We are making many more requests to the db now that we are making us >>>>>>> of AJAX as well. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Could this all be caused by locking errors? Has anybody had any >>>>>>> similar problems with hibernate, this cache provider mentioned above or >>>>>>> any >>>>>>> other cache providers? >>>>>>> >>>>>>> >>>>>>> >>>>>>> If you guys know of anything that could help, even a point in the >>>>>>> write direction would be greatly appreciated. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> >>>>>>> >>>>>>> Ryan Meder >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> see my blog: >>>>> http://analysis102.blogspot.com >>>>> http://audiblethoughts.blogspot.com >>>>> http://outsideofficehours.blogspot.com >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Regards, >>>>> >>>>> Ryan Meder >>>>> >>>>> >> >> >> -- >> see my blog: >> http://analysis102.blogspot.com >> http://audiblethoughts.blogspot.com >> http://outsideofficehours.blogspot.com>> >> -- see my blog: http://analysis102.blogspot.com http://audiblethoughts.blogspot.com http://outsideofficehours.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CTJUG Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/CTJUG-Forum For the ctjug home page see http://www.ctjug.org.za -~----------~----~----~----~------~----~------~--~---
