Or, if he doesn't have a current investment in Hibernate, use Cayenne
(which doesn't have lazy loading problems/etc).

/dev/mrg


-----Original Message-----
From: James Carman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 24, 2006 11:19 AM
To: 'Tapestry users'
Subject: RE: Hibernate persisted data never makes it to DB


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