Hi James,

to you first question - since I am ultimately the one who has to fix problems once stuff goes into production - yes, I do want to know the internals of things. I am pretty convinced that without that knowledge you only get that far. Sure it's nice to use something that will just magically work, but I generally like the feeling of knowing what I do and why, although it takes longer that way - that's why I am going the hard route ;-)

About the transaction part: I use Spring's HibernateTemplate, so I am thinking that will do it for me, no?
Here is my save method of my DAO:

public class RoomDao extends HibernateDaoSupport implements RoomDaoIF {
....
   public void save(RoomIF room) {
       getHibernateTemplate().saveOrUpdate(room);
   }
...
}

Generally, I am still planning on using Tapernate or something similar, but so far I was under the impression that the one main thing they deal with is the lazy-load problem and that they are an alternative to just adding a traditional OpenSessionInView filter. Plus some very convenient bonus add-ons of course, but those seemed to be secondary. But I might be wrong.

That's why I wanted to wait with using Tapernate until I actually run into the lazy-load problem. I want so first see what problems come up and why. Once I have figured that out, and I switch to Tapernate and the lazy-load problem goes away, I know that I am using Tapernate the right way.


MARK


James Carman wrote:
Unless you really want to know the guts of what's going on, I'd suggest
using a framework (<shameless plug>like tapernate for example</shameless
plug>) to get you up and running.  Are you ever committing your transaction?

_____ From: Mark [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 24, 2006 11:16 AM
To: Tapestry users
Subject: Hibernate persisted data never makes it to DB

Hi everybody,

I have a problem with my persistence and I am not sure if it has to do with
the often-discussed Hibernate-Tapestry interaction, OpenSessionInView
filters (and me not using any), just my cache settings or something entirely
different altogether.

I am running Tapestry with Spring and Hibernate. Spring has the Hibernate3
session factory configured through a
org.springframework.orm.hibernate3.LocalSessionFactoryBean

I am not using any OpenSessionInView filters yet - intentionally, because I
wanted to run into the lazy-load problems first in order to verify that what
I would then do will actually fix the problem.

Here is the problem that I currently have:
When I start up Tomcat, Hibernate gets properly initiated, loads my
mappings, shows the proper DB connection details (MySQL 5.0) and then waits
for work.
I go to my app's "Add" page (just basic CRUD for now) to add a new oject.
The Tomcat console shows the proper SQL INSERT statement generated by
Hibernate. However, the database is still empty.
I add another bunch of objects, go back to my list page, and they are all
there. The database table is still empty.

I thought this probably has to do with the fact that Hibernate keeps the
data cached for a while untit it really writes it to the DB. But even after
I shut down Tomcat, the table is empty.
When I start up again, all my records are gone.

I also thought that Tomcat maybe shuts down before Hibernate could persist
everything and that therefore there needs to be a shutdown-listener that
tells Hibernate to flush the cash to the DB. If that was the case, I would
expect that hundreds of beginners made the same mistake as I did and there
should be plenty of info about this on the web, but google came back with
nothing...

Both Tomcat console and Tomcat logs show absolutely no error message -
neither related nor unrelated.

Does anybody know what the problem is?

This is the first time ever that I play with all Hibernate, Tapestry and
Tomcat, so it may very well be a stupid error by a bloody beginner ... :-)

Thanks,

MARK



P.S.: My log4j is configured to write out a log file for hibernate, but I
can not find it. Where would that get created?

log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=hibernate.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
%m%n

--------------------------------------------------------------------- To
unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to