From: Jason N. <no...@ae...> - 2004-11-13 22:24:24
|
Hi Jim, Thanks for your note-- I even purchased a copy of your book a month ago! It's been very useful, since not a lot of printed documentation on Hibernate was available. I am using transactions in my code and performing a tx.commit() after an operation, despite seeing that c3p0's default is autocommit off. I can try some more tests, but it really seems to me that creating a new database and starting over works whereas using the existing database with > 5000 entries has stopped working such that all additions are lost. Thanks, Jason On Nov 12, 2004 05:13 PM, Jim Elliott <jim...@be...> wrote: > I ran into behavior like this when I was putting together my examples > for "Hibernate: A Developer's Notebook". As it happens, I chose HSQLDB > as the database to work with in the book, because it's so darn easy > and > useful. > > Jason, are you coding explicit transactions in your Java code? Here is > the warning I came up with for page 46: > > "Although the Hibernate reference documentation states that the use of > transactions is optional, I found that (at least through version > 2.1.1, > with the HSQLDB database) any changes I made outside the context of a > Hibernate transaction would disappear when the application ended. > Analyzing the SQL emitted by Hibernate revealed that even though I > didn't request a transaction, auto-commit was being turned off, so my > changes were getting rolled back when the application ended. So for > now > it's always necessary to use explicit transactions in your code, a > good > habit in any case." > > -Jim > > On Fri, 2004-11-12 at 07:36, Jason Novotny wrote: > > Hi Fred, > > > > I'm accessing HsqlDB thru Hibernate layer-- what must I do to make > > sure data is being committed before shutting down? > > > > Thanks, Jason > > > > fredt wrote: > > > > >It apparently sets autocommit to false and does not commit the data > > >before > > >shutting down the app. > > > > > >Fred > > > > > >----- Original Message ----- > > >From: "Jason Novotny" <no...@ae...> > > >To: <hsq...@li...> > > >Sent: 12 November 2004 12:39 > > >Subject: [Hsqldb-user] losing data with HsqlDB > > > > > > > > >Hi, > > > > > >I'm using latest Hibernate in my webapp framework and I've > > >configured it > > >to use HsqlDB. When I start my web application using Tomcat, I see > > >the > > >last contents of my database as well as this > > > > > > CONNECT USER sa PASSWORD appended to the end of the file: > > > > > >INSERT INTO DOWNLOAD_INFO > > > > >>VALUES('42de6054fffef7de01001e1383730108','Test','Te...@te...','Test',NULL,0,false,1100016223090,'Mozilla/4.0 > > >(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705)') > > >INSERT INTO DOWNLOAD_INFO > > > > >>VALUES('42de6054fffef7de01001e6b7fbc0109','Test','Te...@te...','Test',NULL,0,false,1100021989307,'Mozilla/4.0 > > >(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705)') > > >/*C1*/CONNECT USER sa PASSWORD "" > > >SET AUTOCOMMIT FALSE > > > > > >Now, data can be added to the database, but it can't retrieve it > > >e.g. > > > > > >INSERT INTO DOWNLOAD_INFO > > > > >>VALUES('42de6054fffef7de01001e1383730108','Test','Te...@te...','Test',NULL,0,false,1100016223090,'Mozilla/4.0 > > >(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705)') > > >INSERT INTO DOWNLOAD_INFO > > > > >>VALUES('42de6054fffef7de01001e6b7fbc0109','Test','Te...@te...','Test',NULL,0,false,1100021989307,'Mozilla/4.0 > > >(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705)') > > >/*C1*/CONNECT USER sa PASSWORD "" > > >SET AUTOCOMMIT FALSE > > >INSERT INTO DOWNLOAD_INFO > > > > >>VALUES('42de6054fffef7de01001e6b7fbc0109','Test2','Te...@te...','Test2',NULL,0,false,1100021989307,'Mozilla/4.0 > > >(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705)') > > > > > >will not let me query for the last DOWNLOAD_INFO Test2. > > > > > >Furthermore when I shut down the webapp and restart, the Test2 and > > >any > > >inserts after the /*C1*/CONNECT statement is totally lost!!! > > > > > >What can I do? I've tried manually editing the file after shutting > > >down > > >but that doesn't help. > > > > > > Thanks, Jason > > > > > > > > > > > > > > >------------------------------------------------------- > > >This SF.Net email is sponsored by: > > >Sybase ASE Linux Express Edition - download now for FREE > > >LinuxWorld Reader's Choice Award Winner for best database on Linux. > > >http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > > >_______________________________________________ > > >Hsqldb-user mailing list > > >Hsq...@li... > > >https://lists.sourceforge.net/lists/listinfo/hsqldb-user > > > > > > > > > > > >------------------------------------------------------- > > >This SF.Net email is sponsored by: > > >Sybase ASE Linux Express Edition - download now for FREE > > >LinuxWorld Reader's Choice Award Winner for best database on Linux. > > >http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > > >_______________________________________________ > > >Hsqldb-user mailing list > > >Hsq...@li... > > >https://lists.sourceforge.net/lists/listinfo/hsqldb-user > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: > > Sybase ASE Linux Express Edition - download now for FREE > > LinuxWorld Reader's Choice Award Winner for best database on Linux. > > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > > _______________________________________________ > > Hsqldb-user mailing list > > Hsq...@li... > > https://lists.sourceforge.net/lists/listinfo/hsqldb-user > -- > Jim Elliott > Berbee > 5520 Research Park Drive Madison, WI 53711 > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > _______________________________________________ > Hsqldb-user mailing list > Hsq...@li... > https://lists.sourceforge.net/lists/listinfo/hsqldb-user > |