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 > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
