RE: Hibernate persisted data never makes it to DB
+1 Don't use autocommit. You might wind up changed pojo's where you've changed a couple properties yet never called/save/update commit etc. Just specify transactional advice on your persistence manager. Shame there is no way to specify spring transactional advice on pages/actions like other frameworks can. Hopefully the next version of tapestry will take away that limitation. -Original Message- From: Konstantin Iignatyev [mailto:[EMAIL PROTECTED] Sent: Friday, May 26, 2006 1:46 AM To: Tapestry users Subject: Re: Hibernate persisted data never makes it to DB autocommit is not the best approach. I suggest you to have a glance at the article for inspiration http://www.onjava.com/pub/a/onjava/2005/05/18/swingxactions.html?page=1 Mark wrote: > I added "hibernate.connection.autocommit=true" to my > hibernate.properties and that fixed it... > > So I assume Spring by default does no Session/TX handling, unless I > use the HibernateTransactionManager or do programmatic transaction > handling... > One last question, to get back to Tapestry - is Spring's > OpenSessionInViewFilter going to work > with Tapestry without limitations? > I see all these posts about Tapernate and others, but I'm not sure > whether OpenSessionInViewFilter will work... > > Thanks, > > MARK > > > > Mark wrote: >> Lutz Hühnken wrote: >>> I asked for applicationContext.xml, and I get a mysql log... well, >>> near enough :) >> Sorry, I thought what I had found in the mysql log (the "set >> autocommit=0, no "commit" call and explicit "Rollback" call issued by >> Hibernate at shutdown) changed things a lot, but maybe not. >>>> From your last mail I understand you have the same problem if you use >>> the mysql command line client. >> No, the command line INSERT does make it, the records just don't get >> picked up by Hibernate... >>> So generally, your sql statements never get committed... which is >>> weird, because by default, mysql starts new connections with >>> autocommit enabled. >> No, only the ones coming from my webapp do not get committed. >>> >>> If you connect to mysql from the command line and do >>> select @@autocommit; >>> what do you get? >> I get "1" >>> Oh, and although the classname you use for the jdbc driver still >>> works, since the mysql connector/j provides backwards compatibility in >>> this respect, nowadays people tend to use "com.mysql.jdbc.Driver" >>> because of a name change four years ago. >> Ok, thanks, I changed that. >> >> - >> 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] -- Thanks, Konstantin Ignatyev http://www.kgionline.com PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2.700 tons of CFCs to the stratosphere, and increase their population by 263.000 Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools. New York: State University of New York Press, 1997: (4) (5) (p.206) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message, including any attachments, is intended only for the recipient(s) named above. It may contain confidential and privileged information. If you have received this communication in error, please notify the sender immediately and destroy or delete the original message. Also, please be aware that if you are not the intended recipient, any review, disclosure, copying, distribution or any action or reliance based on this message is prohibited by law. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
Like I said before, I have not been using any transaction manager. I thought that it would not be necessary - or better that in case there is none, the behaviour would be to just commit a query as soon as it comes through. I added TransactionManager, Interceptor and AutoProxyCreator and everything works now, and keeps working after turning autocommit off again. Some more things below... Mark, I added "hibernate.connection.autocommit=true" to my hibernate.properties and that fixed it... hm. I don't know if that's a good idea. I'm not comfortable with hibernate.properties in a Spring environment, anyway. Is it clear to you in which order they are read? I do not use spring to configure hibernate in all details. I use hibernate.properties and use Spring to wire the SessionFactory together with all the other pieces One last question, to get back to Tapestry - is Spring's OpenSessionInViewFilter going to work with Tapestry without limitations? Afaik yes. What limitations where you thinking of? I can't think of any right now. I don't understand the apparent popularity of it, though, I think it's not that good a concept. I didn't think of anything in particular. I was trying to figure out if I should use Tapernate, HiveTranse, or HoneyComb or if I could "simply" (not sure which one is easier - probably a matter of taste and habit!?) use OpenSessionInViewFilter instead of all these other options. I guess I had not considered that the reason why people are not using OpenSessionInViewFilter is that they don't use Spring at all in the first place. I see all these posts about Tapernate and others, but I'm not sure whether OpenSessionInViewFilter will work... I might be mistaken, but I thought Tapernate was about providing a Hibernate session factory through hivemind, allowing you to inject it into your Daos *without* Spring. Plus some extra stuff for convenience (similar to the OpenSessionInViewFilter from Spring). What is the benefit of "Tapernate" when you are going to use Spring anyway? Maybe someone could enlighten me on this? I'll start a new thread on that, I have a similar question as well... MARK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Hibernate persisted data never makes it to DB
Tapernate doesn't use Spring as the dependency injection container. It uses the Spring tx-management stuff behind the scenes, though. -Original Message- From: Lutz Hühnken [mailto:[EMAIL PROTECTED] Sent: Saturday, May 27, 2006 9:08 AM To: Tapestry users Subject: Re: Hibernate persisted data never makes it to DB Mark, > I added "hibernate.connection.autocommit=true" to my > hibernate.properties and that fixed it... hm. I don't know if that's a good idea. I'm not comfortable with hibernate.properties in a Spring environment, anyway. Is it clear to you in which order they are read? Will Spring configuration override hibernate.properties, or the other way around? And about this property: if it was set to or defaults to false, it probably does so for a reason. Why is that so, and why does noone else besides you experience the behaviour you experience? Still a lot of questions unanswered... > So I assume Spring by default does no Session/TX handling, unless I use the > HibernateTransactionManager or do programmatic transaction handling... Well, that's not quite possible, is it? Of course it handles sessions and transactions, it's not just a mock-up, you know. Talking about transaction managers - what do you have configured there? I said this in every post on this topic so far, and this being the last one I will say it just once more: Do check your applicationContext.xml. I'm sure you'll find the reason for the undesired behaviour in there. Your setup is configured in a way that it does not show the default behaviour. > One last question, to get back to Tapestry - is Spring's > OpenSessionInViewFilter going to work with Tapestry without limitations? Afaik yes. What limitations where you thinking of? I can't think of any right now. I don't understand the apparent popularity of it, though, I think it's not that good a concept. > I see all these posts about Tapernate and others, but I'm not sure whether > OpenSessionInViewFilter will work... I might be mistaken, but I thought Tapernate was about providing a Hibernate session factory through hivemind, allowing you to inject it into your Daos *without* Spring. Plus some extra stuff for convenience (similar to the OpenSessionInViewFilter from Spring). What is the benefit of "Tapernate" when you are going to use Spring anyway? Maybe someone could enlighten me on this? regards, Lutz - 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]
Re: Hibernate persisted data never makes it to DB
Mark, I added "hibernate.connection.autocommit=true" to my hibernate.properties and that fixed it... hm. I don't know if that's a good idea. I'm not comfortable with hibernate.properties in a Spring environment, anyway. Is it clear to you in which order they are read? Will Spring configuration override hibernate.properties, or the other way around? And about this property: if it was set to or defaults to false, it probably does so for a reason. Why is that so, and why does noone else besides you experience the behaviour you experience? Still a lot of questions unanswered... So I assume Spring by default does no Session/TX handling, unless I use the HibernateTransactionManager or do programmatic transaction handling... Well, that's not quite possible, is it? Of course it handles sessions and transactions, it's not just a mock-up, you know. Talking about transaction managers - what do you have configured there? I said this in every post on this topic so far, and this being the last one I will say it just once more: Do check your applicationContext.xml. I'm sure you'll find the reason for the undesired behaviour in there. Your setup is configured in a way that it does not show the default behaviour. One last question, to get back to Tapestry - is Spring's OpenSessionInViewFilter going to work with Tapestry without limitations? Afaik yes. What limitations where you thinking of? I can't think of any right now. I don't understand the apparent popularity of it, though, I think it's not that good a concept. I see all these posts about Tapernate and others, but I'm not sure whether OpenSessionInViewFilter will work... I might be mistaken, but I thought Tapernate was about providing a Hibernate session factory through hivemind, allowing you to inject it into your Daos *without* Spring. Plus some extra stuff for convenience (similar to the OpenSessionInViewFilter from Spring). What is the benefit of "Tapernate" when you are going to use Spring anyway? Maybe someone could enlighten me on this? regards, Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
For the record, Spring's OpenSessionInView filter works just fine for us. As for your commit issues, I don't really know what is failing to work for you. We are using the hibernateTransactionManager, transactionInterceptor, and autoProxyCreator to have spring automatically start and commit transactions around the methods in our service classes. It works like a charm, but there isn't a single line of code that deals with transactions in our codebase (outside the applicationContext.xml) so I can't tell you what is failing in yours. Here is a spring config that automatically wraps transaction semantics around any method with a name that starts with 'update' in several service classes. com.euroclick.eurolib.service.CustomerService.update*=PROPAGATION_REQUIRED,ISOLATION_REPEATABLE_READ com.euroclick.eurolib.service.CustomerService.create*=PROPAGATION_REQUIRED,ISOLATION_REPEATABLE_READ com.euroclick.eurolib.service.ReportService.update*=PROPAGATION_REQUIRED,ISOLATION_REPEATABLE_READ com.euroclick.eurolib.service.AdvConversionPageService.create*=PROPAGATION_REQUIRED,ISOLATION_REPEATABLE_READ transactionInterceptor --sam On 5/26/06, Mark <[EMAIL PROTECTED]> wrote: I will, thanks. MARK James Carman wrote: > Why don't you just give Tapernate a try? There are a few folks using it > already and it is working for them just fine. > > - 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]
Re: Hibernate persisted data never makes it to DB
I will, thanks. MARK James Carman wrote: Why don’t you just give Tapernate a try? There are a few folks using it already and it is working for them just fine. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Hibernate persisted data never makes it to DB
Why dont you just give Tapernate a try? There are a few folks using it already and it is working for them just fine. _ From: Mark [mailto:[EMAIL PROTECTED] Sent: Friday, May 26, 2006 1:35 AM To: Tapestry users Subject: Re: Hibernate persisted data never makes it to DB I added "hibernate.connection.autocommit=true" to my hibernate.properties and that fixed it... So I assume Spring by default does no Session/TX handling, unless I use the HibernateTransactionManager or do programmatic transaction handling... One last question, to get back to Tapestry - is Spring's OpenSessionInViewFilter going to work with Tapestry without limitations? I see all these posts about Tapernate and others, but I'm not sure whether OpenSessionInViewFilter will work... Thanks, MARK Mark wrote: Lutz Hühnken wrote: I asked for applicationContext.xml, and I get a mysql log... well, near enough :) Sorry, I thought what I had found in the mysql log (the "set autocommit=0, no "commit" call and explicit "Rollback" call issued by Hibernate at shutdown) changed things a lot, but maybe not. >From your last mail I understand you have the same problem if you use the mysql command line client. No, the command line INSERT does make it, the records just don't get picked up by Hibernate... So generally, your sql statements never get committed... which is weird, because by default, mysql starts new connections with autocommit enabled. No, only the ones coming from my webapp do not get committed. If you connect to mysql from the command line and do select @@autocommit; what do you get? I get "1" Oh, and although the classname you use for the jdbc driver still works, since the mysql connector/j provides backwards compatibility in this respect, nowadays people tend to use "com.mysql.jdbc.Driver" because of a name change four years ago. Ok, thanks, I changed that. - 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]
Re: Hibernate persisted data never makes it to DB
No, I know that... I'm just playing around with the simple baby steps for now and will add Transactions later on... But thank you for the warning. MARK Konstantin Iignatyev wrote: autocommit is not the best approach. I suggest you to have a glance at the article for inspiration http://www.onjava.com/pub/a/onjava/2005/05/18/swingxactions.html?page=1 Mark wrote: I added "hibernate.connection.autocommit=true" to my hibernate.properties and that fixed it... So I assume Spring by default does no Session/TX handling, unless I use the HibernateTransactionManager or do programmatic transaction handling... One last question, to get back to Tapestry - is Spring's OpenSessionInViewFilter going to work with Tapestry without limitations? I see all these posts about Tapernate and others, but I'm not sure whether OpenSessionInViewFilter will work... Thanks, MARK Mark wrote: Lutz Hühnken wrote: I asked for applicationContext.xml, and I get a mysql log... well, near enough :) Sorry, I thought what I had found in the mysql log (the "set autocommit=0, no "commit" call and explicit "Rollback" call issued by Hibernate at shutdown) changed things a lot, but maybe not. From your last mail I understand you have the same problem if you use the mysql command line client. No, the command line INSERT does make it, the records just don't get picked up by Hibernate... So generally, your sql statements never get committed... which is weird, because by default, mysql starts new connections with autocommit enabled. No, only the ones coming from my webapp do not get committed. If you connect to mysql from the command line and do select @@autocommit; what do you get? I get "1" Oh, and although the classname you use for the jdbc driver still works, since the mysql connector/j provides backwards compatibility in this respect, nowadays people tend to use "com.mysql.jdbc.Driver" because of a name change four years ago. Ok, thanks, I changed that. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
autocommit is not the best approach. I suggest you to have a glance at the article for inspiration http://www.onjava.com/pub/a/onjava/2005/05/18/swingxactions.html?page=1 Mark wrote: I added "hibernate.connection.autocommit=true" to my hibernate.properties and that fixed it... So I assume Spring by default does no Session/TX handling, unless I use the HibernateTransactionManager or do programmatic transaction handling... One last question, to get back to Tapestry - is Spring's OpenSessionInViewFilter going to work with Tapestry without limitations? I see all these posts about Tapernate and others, but I'm not sure whether OpenSessionInViewFilter will work... Thanks, MARK Mark wrote: Lutz Hühnken wrote: I asked for applicationContext.xml, and I get a mysql log... well, near enough :) Sorry, I thought what I had found in the mysql log (the "set autocommit=0, no "commit" call and explicit "Rollback" call issued by Hibernate at shutdown) changed things a lot, but maybe not. From your last mail I understand you have the same problem if you use the mysql command line client. No, the command line INSERT does make it, the records just don't get picked up by Hibernate... So generally, your sql statements never get committed... which is weird, because by default, mysql starts new connections with autocommit enabled. No, only the ones coming from my webapp do not get committed. If you connect to mysql from the command line and do select @@autocommit; what do you get? I get "1" Oh, and although the classname you use for the jdbc driver still works, since the mysql connector/j provides backwards compatibility in this respect, nowadays people tend to use "com.mysql.jdbc.Driver" because of a name change four years ago. Ok, thanks, I changed that. - 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] -- Thanks, Konstantin Ignatyev http://www.kgionline.com PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2.700 tons of CFCs to the stratosphere, and increase their population by 263.000 Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools. New York: State University of New York Press, 1997: (4) (5) (p.206) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
I added "hibernate.connection.autocommit=true" to my hibernate.properties and that fixed it... So I assume Spring by default does no Session/TX handling, unless I use the HibernateTransactionManager or do programmatic transaction handling... One last question, to get back to Tapestry - is Spring's OpenSessionInViewFilter going to work with Tapestry without limitations? I see all these posts about Tapernate and others, but I'm not sure whether OpenSessionInViewFilter will work... Thanks, MARK Mark wrote: Lutz Hühnken wrote: I asked for applicationContext.xml, and I get a mysql log... well, near enough :) Sorry, I thought what I had found in the mysql log (the "set autocommit=0, no "commit" call and explicit "Rollback" call issued by Hibernate at shutdown) changed things a lot, but maybe not. From your last mail I understand you have the same problem if you use the mysql command line client. No, the command line INSERT does make it, the records just don't get picked up by Hibernate... So generally, your sql statements never get committed... which is weird, because by default, mysql starts new connections with autocommit enabled. No, only the ones coming from my webapp do not get committed. If you connect to mysql from the command line and do select @@autocommit; what do you get? I get "1" Oh, and although the classname you use for the jdbc driver still works, since the mysql connector/j provides backwards compatibility in this respect, nowadays people tend to use "com.mysql.jdbc.Driver" because of a name change four years ago. Ok, thanks, I changed that. - 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]
Re: Hibernate persisted data never makes it to DB
Lutz Hühnken wrote: I asked for applicationContext.xml, and I get a mysql log... well, near enough :) Sorry, I thought what I had found in the mysql log (the "set autocommit=0, no "commit" call and explicit "Rollback" call issued by Hibernate at shutdown) changed things a lot, but maybe not. From your last mail I understand you have the same problem if you use the mysql command line client. No, the command line INSERT does make it, the records just don't get picked up by Hibernate... So generally, your sql statements never get committed... which is weird, because by default, mysql starts new connections with autocommit enabled. No, only the ones coming from my webapp do not get committed. If you connect to mysql from the command line and do select @@autocommit; what do you get? I get "1" Oh, and although the classname you use for the jdbc driver still works, since the mysql connector/j provides backwards compatibility in this respect, nowadays people tend to use "com.mysql.jdbc.Driver" because of a name change four years ago. Ok, thanks, I changed that. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
On 5/25/06, Lutz Hühnken <[EMAIL PROTECTED]> wrote: Yes, the Spring HibernateTemplate will take care of that for you. The actual behaviour depends on your transaction management, but let's not get into that for now. So, the save you call will commit the changes to the database. Hibernate then disconnects the session, I believe, anyhow, there is no need for you to add extra code. I don't believe the hibernate template disconnects the session for you. The hibernate template is just a facility to access hibernate functions. The DAO functions seem to commit and flush according to the transactional behavior (I did not find any exact information on that). I agree with Lutz, this has something to do with your spring configuration. Somehow your transactional configuration doesn't commit the operations. Thanks, Henri.
Re: Hibernate persisted data never makes it to DB
I asked for applicationContext.xml, and I get a mysql log... well, near enough :) From your last mail I understand you have the same problem if you use the mysql command line client. Makes me wonder why you thought the problem had to do with Hibernate in the first place (let alone Tapestry, for this Tapestry mailing list this has been OT for a while now...). So generally, your sql statements never get committed... which is weird, because by default, mysql starts new connections with autocommit enabled. If you connect to mysql from the command line and do select @@autocommit; what do you get? About your Hibernate configuration, since you use Spring anyway, I would recommend you use Spring for the datasource setup, makes it easier to switch, plus it makes sense (to me, anyway) to have it in the same place as the SessionFactory. Oh, and although the classname you use for the jdbc driver still works, since the mysql connector/j provides backwards compatibility in this respect, nowadays people tend to use "com.mysql.jdbc.Driver" because of a name change four years ago. lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
So... - have you checked the rest of your code? Are you sure this piece of code is actually called? Step through it or add debugging output. I don't know how else I would get the Hibernate log output: "Hibernate: insert into room (roomType, roomNumber, smoking, active) values (?, ?, ?, ?)" How can I get Hibernate to show the log output with the values? I went over the mysql logs and at the end finally found something. If you want, you can skip directly to the place where I say "Oops" I checked the MySQL logs and I even have the query in there... Here are the mysql logs: Here is my insert... 3 Prepare [7] 3 Execute [7] insert into room (roomType, roomNumber, smoking, active) values ('PRM', '12', 'F', 'F') Then comes the select that displayes the new list 060525 8:14:45 3 Prepare [8] 3 Execute [8] select room0_.id as id0_, room0_.roomType as roomType0_, room0_.roomNumber as roomNumber0_, room0_.smoking as smoking0_, room0_.active as active0_ from room room0_ The room is in the list Then comes my mysql command line client to check the table: 060525 8:16:53 4 Connect [EMAIL PROTECTED] on rbs1 4 Query select * from room 060525 8:17:01 4 Query select * from room And the result is "Empty set" Now I try to insert the same record ( just with number 120 rather than 12) from the command line: 060525 8:19:36 4 Query insert into room (roomType, roomNumber, smoking, active) values ('PRM', '120', 'F', 'F') And another commandline select to verify: 060525 8:19:40 4 Query select * from room It comes back with the new record (120) Then comes Hibernate (I refresh the browser list page): 060525 8:21:00 3 Prepare [12] 3 Execute [12] select room0_.id as id0_, room0_.roomType as roomType0_, room0_.roomNumber as roomNumber0_, room0_.smoking as smoking0_, room0_.active as active0_ from room room0_ The result is still the old one (only room 12, not room 120) Now I restart Tomcat... Oops... I just found something interesting: This was called when Tomcat shut down: 060525 8:22:48 3 Query rollback 3 Quit This was called in the beginning when Tomcat started: 3 Query SET autocommit=1 3 Query SET autocommit=0 So Spring never executed commit, instead goes through all my web requests on just one session and at the end calls rollback (no idea why it doesn't commit). So I guess this is what happens... now the question: how do I fix it? MARK P.S.: Here is my Hibernate configuration: hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect hibernate.connection.driver_class=org.gjt.mm.mysql.Driver hibernate.connection.password=password hibernate.connection.url=jdbc:mysql://localhost/rbs1 hibernate.connection.username=rbs hibernate.cache.provider_class = org.hibernate.cache.HashtableCacheProvider hibernate.show_sql = true - if you're sure your application is otherwise correct, the code gets executed with the room object you intend it to, and you still don't have anything in your database, I believe you have something severely misconfigured and suggest you post your configuration. That would be the part of your Spring applicationContext.xml (or whatever it is called in your case) where you set up the data source and the session factory. some more comments... I figured since everybody has problems with Spring closing sessions too early and thereby causing problems with lazy-load, it should not affect me in this case and actually work for me. But maybe not??? Since you have no problem with lazy loading, in fact, you are not even loading, I believe keeping the session open until the view is rendered will not help you. The Page gets the Service (a singleton SpringBean) via tapestry-spring library ("spring:..."). The Service gets a DAO through Spring IoC. Just out of curiosity: Why do you not inject your Dao into the page? What does "the Service"? do? So I guess the DAO is a singleton that opens a session once and never closes it? Does that mean that everything is one session/transaction, across all requests and user-web-sessions? No. hth, Lutz - 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]
Re: Hibernate persisted data never makes it to DB
Yes, the Spring HibernateTemplate will take care of that for you. The actual behaviour depends on your transaction management, but let's not get into that for now. So, the save you call will commit the changes to the database. Hibernate then disconnects the session, I believe, anyhow, there is no need for you to add extra code. Since you even flush your session, there is no doubt Hibernate will try to store your object in the database. Even if it doesn't work, you should get some exception. So... - have you checked the rest of your code? Are you sure this piece of code is actually called? Step through it or add debugging output. - if you're sure your application is otherwise correct, the code gets executed with the room object you intend it to, and you still don't have anything in your database, I believe you have something severely misconfigured and suggest you post your configuration. That would be the part of your Spring applicationContext.xml (or whatever it is called in your case) where you set up the data source and the session factory. some more comments... I figured since everybody has problems with Spring closing sessions too early and thereby causing problems with lazy-load, it should not affect me in this case and actually work for me. But maybe not??? Since you have no problem with lazy loading, in fact, you are not even loading, I believe keeping the session open until the view is rendered will not help you. The Page gets the Service (a singleton SpringBean) via tapestry-spring library ("spring:..."). The Service gets a DAO through Spring IoC. Just out of curiosity: Why do you not inject your Dao into the page? What does "the Service"? do? So I guess the DAO is a singleton that opens a session once and never closes it? Does that mean that everything is one session/transaction, across all requests and user-web-sessions? No. hth, Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
Aeh... I was relying on Spring doing the right thing?! (10 extra points to Lutz ;-) ) I figured since everybody has problems with Spring closing sessions too early and thereby causing problems with lazy-load, it should not affect me in this case and actually work for me. But maybe not??? I honestly have to say I'm not sure how Spring's HibernateTemplate handles this in detail... The more I think about it the closer I get to calling myself a Moron... :-) Ok... here is the deal: The Page gets the Service (a singleton SpringBean) via tapestry-spring library ("spring:..."). The Service gets a DAO through Spring IoC. The DAO gets a SessionFactory via Spring IoC. The DAO uses getHibernateTemplate() to do the Hibernate-specific stuff. So I guess the DAO is a singleton that opens a session once and never closes it? Does that mean that everything is one session/transaction, across all requests and user-web-sessions? There is no code at all in the DAO that deals with sessions or transactions. So if Spring doesn't do it, then nothing does. I just tried to add a flush to my DAO.save() method, but that does not change anything either: public save(Room room) { getHibernateTemplate().saveOrUpdate(room); getHibernateTemplate().flush(); } I implemented my DAO according to the examples in the Spring reference PDF, but I just noticed that all the examples in there are read-operations, no inserts/updates/saves. I think it's time to dig through a bunch of those Spring books - I should have probably done that earlier. MARK Henri Dupre wrote: On 5/24/06, Mark <[EMAIL PROTECTED]> wrote: Is there a way to set this in the hibernate.properties? Right now I do not use OpenSessionInViewFilter... Oops I should have read the whole thread before answering ;-) So how do you manage your sessions? Thanks, Henri. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
On 5/24/06, Mark <[EMAIL PROTECTED]> wrote: Is there a way to set this in the hibernate.properties? Right now I do not use OpenSessionInViewFilter... Oops I should have read the whole thread before answering ;-) So how do you manage your sessions? Thanks, Henri.
Re: Hibernate persisted data never makes it to DB
Does anybody have a standard plain-vanilla hibernate.conf file for me so I can compare it to mine? Also, I am not using any hibernate.cfg.xml, but I assume I don't have to... MARK Lutz Hühnken wrote: Hm... given that you don't use OpenSessionInViewFilter, I think it is really pretty optimistic to believe your current problem can be solved by subclassing it and/or changing its flushing behaviour. On 5/25/06, Mark <[EMAIL PROTECTED]> wrote: Is there a way to set this in the hibernate.properties? Right now I do not use OpenSessionInViewFilter... MARK Daniel Lydiard wrote: > Are you using OpenSessionInViewFilter (spring/hibernate)? > > The default flushmode is set to NEVER, so you need to override > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter > @Override > > protected Session getSession(SessionFactory sessionFactory) throws > DataAccessResourceFailureException { > > Session session = super.getSession(sessionFactory); > > session.setFlushMode(FlushMode.AUTO); > > return session; > > } > > @Override > > protected void closeSession(Session session, SessionFactory > sessionFactory) { > > session.flush(); > > super.closeSession(session, sessionFactory); > > } > - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
Hm... given that you don't use OpenSessionInViewFilter, I think it is really pretty optimistic to believe your current problem can be solved by subclassing it and/or changing its flushing behaviour. On 5/25/06, Mark <[EMAIL PROTECTED]> wrote: Is there a way to set this in the hibernate.properties? Right now I do not use OpenSessionInViewFilter... MARK Daniel Lydiard wrote: > Are you using OpenSessionInViewFilter (spring/hibernate)? > > The default flushmode is set to NEVER, so you need to override > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter > @Override > > protected Session getSession(SessionFactory sessionFactory) throws > DataAccessResourceFailureException { > > Session session = super.getSession(sessionFactory); > > session.setFlushMode(FlushMode.AUTO); > > return session; > > } > > @Override > > protected void closeSession(Session session, SessionFactory > sessionFactory) { > > session.flush(); > > super.closeSession(session, sessionFactory); > > } > - 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]
Re: Hibernate persisted data never makes it to DB
On 5/24/06, Mark <[EMAIL PROTECTED]> wrote: 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. I looked quite in details on the OpenSessionInView code and there is something really strange... After a request is completed, several methods are called "close" and "release". These methods only cause the session to be removed from the threadlocal but the hibernate session itself is never closed!! So I bet that then the sessions are just floating in the jvm until they get garbaged. You should try to subclass OpenSessionInView and do a session.close() after a page. Thanks, Henri.
Re: Hibernate persisted data never makes it to DB
Is there a way to set this in the hibernate.properties? Right now I do not use OpenSessionInViewFilter... MARK Daniel Lydiard wrote: Are you using OpenSessionInViewFilter (spring/hibernate)? The default flushmode is set to NEVER, so you need to override org.springframework.orm.hibernate3.support.OpenSessionInViewFilter @Override protected Session getSession(SessionFactory sessionFactory) throws DataAccessResourceFailureException { Session session = super.getSession(sessionFactory); session.setFlushMode(FlushMode.AUTO); return session; } @Override protected void closeSession(Session session, SessionFactory sessionFactory) { session.flush(); super.closeSession(session, sessionFactory); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
Are you using OpenSessionInViewFilter (spring/hibernate)? The default flushmode is set to NEVER, so you need to override org.springframework.orm.hibernate3.support.OpenSessionInViewFilter @Override protected Session getSession(SessionFactory sessionFactory) throws DataAccessResourceFailureException { Session session = super.getSession(sessionFactory); session.setFlushMode(FlushMode.AUTO); return session; } @Override protected void closeSession(Session session, SessionFactory sessionFactory) { session.flush(); super.closeSession(session, sessionFactory); } - Original Message - From: "Mark" <[EMAIL PROTECTED]> To: "Tapestry users" Sent: Wednesday, May 24, 2006 1:58 PM Subject: Re: Hibernate persisted data never makes it to DB By the way - I am right to assume that what I experience here is not normal Hibernate behaviour? MARK Lutz Hühnken wrote: my two cents, in three parts... - about the problem: well, usually, it kind of works. This may sound silly, but do you maybe have hbm2ddl.auto set to "create-drop" ? Or when you check if something has been stored, are you sure you're checking the right database? I'm not making fun of you, I have seen these things happen, to very smart people. One more: are you using the HibernateTemplate from the right package (there is a hibernate and a hibernate3 package. Actually, I don't know what happens if you use the wrong one, might even work). Anyhow, if nothing is stored and yet you don't get any error message, I guess you have to recheck your configuration carefully. - about the log file location if you just give the filename, it will be created in the current working directory. If you start Tomcat from the command line, that will be $CATALINA_HOME/bin. If you start it using the Eclipse plugin, the location is, well, eclipsed - I have not managed to find it yet. Anyhow, both variants are not very desirable, so you might consider providing an absolute path to your logfile (as in /var/log/hibernate.log). Personally, on my development machine, I just log to stdout. - about the "wanting to know the internals": don't get me wrong, no offense intended, and it's really none of my business, I just can't keep the thought to myself: I think it is a very valid standpoint, but I also think it is slightly contradictory in your case. You claim you want to know internals, but yet you use the Spring HibernateTemplate? Isn't that all about hiding a lot of internals? hth, Lutz - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
By the way - I am right to assume that what I experience here is not normal Hibernate behaviour? MARK Lutz Hühnken wrote: my two cents, in three parts... - about the problem: well, usually, it kind of works. This may sound silly, but do you maybe have hbm2ddl.auto set to "create-drop" ? Or when you check if something has been stored, are you sure you're checking the right database? I'm not making fun of you, I have seen these things happen, to very smart people. One more: are you using the HibernateTemplate from the right package (there is a hibernate and a hibernate3 package. Actually, I don't know what happens if you use the wrong one, might even work). Anyhow, if nothing is stored and yet you don't get any error message, I guess you have to recheck your configuration carefully. - about the log file location if you just give the filename, it will be created in the current working directory. If you start Tomcat from the command line, that will be $CATALINA_HOME/bin. If you start it using the Eclipse plugin, the location is, well, eclipsed - I have not managed to find it yet. Anyhow, both variants are not very desirable, so you might consider providing an absolute path to your logfile (as in /var/log/hibernate.log). Personally, on my development machine, I just log to stdout. - about the "wanting to know the internals": don't get me wrong, no offense intended, and it's really none of my business, I just can't keep the thought to myself: I think it is a very valid standpoint, but I also think it is slightly contradictory in your case. You claim you want to know internals, but yet you use the Spring HibernateTemplate? Isn't that all about hiding a lot of internals? hth, Lutz - 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]
Re: Hibernate persisted data never makes it to DB
Thanks for your email, Lutz. Please see below for comments.. my two cents, in three parts... - about the problem: well, usually, it kind of works. This may sound silly, but do you maybe have hbm2ddl.auto set to "create-drop" ? Don't know what that does but I'll try it later, once I figure out how and where to set that... Or when you check if something has been stored, are you sure you're checking the right database? I'm not making fun of you, I have seen these things happen, to very smart people. One more: are you using the HibernateTemplate from the right package (there is a hibernate and a hibernate3 package. Actually, I don't know what happens if you use the wrong one, might even work). Yes, it's the right DB (only have one) and package. Anyhow, if nothing is stored and yet you don't get any error message, I guess you have to recheck your configuration carefully. - about the log file location if you just give the filename, it will be created in the current working directory. If you start Tomcat from the command line, that will be $CATALINA_HOME/bin. If you start it using the Eclipse plugin, the location is, well, eclipsed - I have not managed to find it yet. Anyhow, both variants are not very desirable, so you might consider providing an absolute path to your logfile (as in /var/log/hibernate.log). Personally, on my development machine, I just log to stdout. I didn't find it in the Tomcat directory (I dont use Eclipse plugins), but I just switched to console output... I did notice this during startup: INFO: Second-level cache: enabled May 24, 2006 1:52:50 PM org.hibernate.cfg.SettingsFactory buildSettings INFO: Query cache: disabled May 24, 2006 1:52:50 PM org.hibernate.cfg.SettingsFactory createCacheProvider INFO: Cache provider: org.hibernate.cache.HashtableCacheProvider May 24, 2006 1:52:50 PM org.hibernate.cfg.SettingsFactory buildSettings INFO: Optimize cache for minimal puts: disabled May 24, 2006 1:52:50 PM org.hibernate.cfg.SettingsFactory buildSettings INFO: Structured second-level cache entries: disabled So it seems like the only cache is the L2 cache. Could it be stuck there? - about the "wanting to know the internals": don't get me wrong, no offense intended, and it's really none of my business, I just can't keep the thought to myself: I think it is a very valid standpoint, but I also think it is slightly contradictory in your case. You claim you want to know internals, but yet you use the Spring HibernateTemplate? Isn't that all about hiding a lot of internals? Well... it's not like I don't want to use the shortcuts, I just want to know how it would work without them first, so I better know what the shortcuts do and why... But still - if you put it that way, then I guess you're kind of right - I could first do the whole thing without HibernateTemplates and then switch to using them once I figured out how thing work without them... ;-) Guess I was so focused on Spring and Hibernate that I left that step out :-) MARK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
my two cents, in three parts... - about the problem: well, usually, it kind of works. This may sound silly, but do you maybe have hbm2ddl.auto set to "create-drop" ? Or when you check if something has been stored, are you sure you're checking the right database? I'm not making fun of you, I have seen these things happen, to very smart people. One more: are you using the HibernateTemplate from the right package (there is a hibernate and a hibernate3 package. Actually, I don't know what happens if you use the wrong one, might even work). Anyhow, if nothing is stored and yet you don't get any error message, I guess you have to recheck your configuration carefully. - about the log file location if you just give the filename, it will be created in the current working directory. If you start Tomcat from the command line, that will be $CATALINA_HOME/bin. If you start it using the Eclipse plugin, the location is, well, eclipsed - I have not managed to find it yet. Anyhow, both variants are not very desirable, so you might consider providing an absolute path to your logfile (as in /var/log/hibernate.log). Personally, on my development machine, I just log to stdout. - about the "wanting to know the internals": don't get me wrong, no offense intended, and it's really none of my business, I just can't keep the thought to myself: I think it is a very valid standpoint, but I also think it is slightly contradictory in your case. You claim you want to know internals, but yet you use the Spring HibernateTemplate? Isn't that all about hiding a lot of internals? hth, Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hibernate persisted data never makes it to DB
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 (like tapernate for example) 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]
RE: Hibernate persisted data never makes it to DB
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 (like tapernate for example) 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]
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 (like tapernate for example) 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]