You can subscribe to this list here.
2002 |
Jan
(2) |
Feb
(157) |
Mar
(111) |
Apr
(61) |
May
(68) |
Jun
(45) |
Jul
(101) |
Aug
(132) |
Sep
(148) |
Oct
(227) |
Nov
(141) |
Dec
(285) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(518) |
Feb
(462) |
Mar
(390) |
Apr
(488) |
May
(321) |
Jun
(336) |
Jul
(268) |
Aug
(374) |
Sep
(211) |
Oct
(246) |
Nov
(239) |
Dec
(173) |
2004 |
Jan
(110) |
Feb
(131) |
Mar
(85) |
Apr
(120) |
May
(82) |
Jun
(101) |
Jul
(54) |
Aug
(65) |
Sep
(94) |
Oct
(51) |
Nov
(56) |
Dec
(168) |
2005 |
Jan
(146) |
Feb
(98) |
Mar
(75) |
Apr
(118) |
May
(85) |
Jun
(75) |
Jul
(44) |
Aug
(94) |
Sep
(70) |
Oct
(84) |
Nov
(115) |
Dec
(52) |
2006 |
Jan
(113) |
Feb
(83) |
Mar
(217) |
Apr
(158) |
May
(219) |
Jun
(218) |
Jul
(189) |
Aug
(39) |
Sep
(3) |
Oct
(7) |
Nov
(4) |
Dec
(2) |
2007 |
Jan
|
Feb
(2) |
Mar
(7) |
Apr
(3) |
May
(3) |
Jun
(8) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(4) |
Nov
(7) |
Dec
|
2008 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2009 |
Jan
(6) |
Feb
|
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(10) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gavin K. <Gav...@ex...> - 2002-12-04 06:16:50
|
It isn't usually; not unless you have toplevel collections... > -----Original Message----- > From: Dave Johnson [mailto:sno...@nc...]=20 > Sent: Wednesday, 4 December 2002 4:09 PM > To: hib...@li... > Subject: [Hibernate] Re: Hibernate vs. Castor example >=20 >=20 >=20 > In the Hibernate implementation of the DAO, I implement the=20 > removeNewsfeed method shown below. Why is the call to=20 > ses.load() necessary? >=20 > - Dave >=20 >=20 > public void removeNewsfeed( Newsfeed feed ) throws DAOException { > removeObject( ag.Newsfeed.class, feed.getId(), feed ); > } >=20 > private void removeObject( Class clazz, String id, Object obj ) > throws DAOException { > Session ses =3D null; > try { > ses =3D sessionFactory.openSession(); > obj =3D ses.load(clazz,id); > ses.delete(obj); > ses.flush(); > ses.connection().commit(); > } > catch (Exception e) { > try { ses.connection().rollback(); } > catch (Exception ex) { e.printStackTrace(); }; > throw new DAOException(e); > } > finally { > try { ses.close(); } > catch (Exception ex) { ex.printStackTrace(); }; > } > } >=20 >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Microsoft Visual Studio.NET=20 > comprehensive development tool, built to increase your=20 > productivity. Try a free online hosted session at:=20 http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel ********** CAUTION - Disclaimer ********** This message may contain privileged and confidential information. If you are not the intended recipient of this message (or responsible for delivery of the message to such person) you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error, you should destroy it and kindly notify the sender by reply e-mail. Please advise immediately if you or your employer do not consent to Internet e-mail for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Expert Information Services Pty Ltd ("The Company") shall be understood as neither given nor endorsed by it. The Company advises that this e-mail and any attached files should be scanned to detect viruses. The Company accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. **EIS******** End of Disclaimer ********** |
From: Dave J. <sno...@nc...> - 2002-12-04 05:10:02
|
In the Hibernate implementation of the DAO, I implement the removeNewsfeed method shown below. Why is the call to ses.load() necessary? - Dave public void removeNewsfeed( Newsfeed feed ) throws DAOException { removeObject( ag.Newsfeed.class, feed.getId(), feed ); } private void removeObject( Class clazz, String id, Object obj ) throws DAOException { Session ses = null; try { ses = sessionFactory.openSession(); obj = ses.load(clazz,id); ses.delete(obj); ses.flush(); ses.connection().commit(); } catch (Exception e) { try { ses.connection().rollback(); } catch (Exception ex) { e.printStackTrace(); }; throw new DAOException(e); } finally { try { ses.close(); } catch (Exception ex) { ex.printStackTrace(); }; } } |
From: Gavin K. <Gav...@ex...> - 2002-12-04 03:16:07
|
Cool. You beat me to it. Thanks for the Resin-specific code - I will integrate it as soon as I get to a PC with CVS access (I've been unable to do anything the past few days.) > -----Original Message----- > From: Aapo Laakkonen [mailto:aap...@pr...]=20 > Sent: Thursday, 5 December 2002 2:06 AM > To: hib...@li... > Subject: RE: [Hibernate] Lazy Collections >=20 >=20 > > 04:18:56,649 WARN > > [JTATransactionFactory] No TransactionManagerLookup configured > > (use of JCS read-write cache is not > recommended) >=20 > Ok there is error in documentation (it's not=20 > hibernate.transaction.manager_class). >=20 > This works:=20 > hibernate.transaction.manager_lookup_class=3Dcirrus.hibernate.tr > ansaction. > ResinTransactionManagerLookup >=20 >=20 > Now it works fine!!!!! Great work! Definately the best O/R tool. >=20 >=20 > --- code --- >=20 > Here is code for ResinTransactionManagerLookup class: >=20 > package cirrus.hibernate.transaction; >=20 > public final class ResinTransactionManagerLookup extends=20 > JNDITransactionManagerLookup { >=20 > /** > * @see > cirrus.hibernate.transaction.JNDITransactionManagerLookup#getName() > */ > protected String getName() { > return "java:comp/TransactionManager"; > } >=20 > } >=20 > --- code --- >=20 ********** CAUTION - Disclaimer ********** This message may contain privileged and confidential information. If you are not the intended recipient of this message (or responsible for delivery of the message to such person) you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error, you should destroy it and kindly notify the sender by reply e-mail. Please advise immediately if you or your employer do not consent to Internet e-mail for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Expert Information Services Pty Ltd ("The Company") shall be understood as neither given nor endorsed by it. The Company advises that this e-mail and any attached files should be scanned to detect viruses. The Company accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. **EIS******** End of Disclaimer ********** |
From: Gavin K. <Gav...@ex...> - 2002-12-04 03:11:58
|
Comments inline.... > 04:18:56,649 WARN > [JTATransactionFactory] No TransactionManagerLookup configured > (use of JCS read-write cache is not=20 > recommended) >=20 > What is this setting. I get that warning even if I don't use JCS.=20 >=20 > This is my hibernate.properties: >=20 > hibernate.use_outer_join=3Dtrue > hibernate.show_sql=3Dfalse > hibernate.jdbc.batch_size=3D10 > hibernate.statement_cache.size=3D20=20 > hibernate.transaction.factory_class=3Dcirrus.hibernate.transacti > on.JTATran > sactionFactory=20 > hibernate.transaction.manager_class=3Dcirrus.hibernate.transacti > on.JNDITra > nsactionManagerLookup > hibernate.query.substitutions yes 'Y', no 'N'=20 > jta.UserTransaction=3Djava:comp/UserTransaction >=20 There was a doco bug that was reported and fixed only recently.=20 (My fault.) The property should be hibernate.transaction.manager_lookup_class But JNDITransactionManagerLookup is not a valid value. You must=20 choose the correct strategy for your application server. Otherwise=20 I don't recommend use of usage=3D"read-write" JCS caching. > Another warning I get with Resin is: >=20 > 04:18:57,258 WARN > [SessionFactoryObjectFactory] InitialContext did not=20 > implement EventContext >=20 > Should I care about it? Nah, don't worry about that one.... ********** CAUTION - Disclaimer ********** This message may contain privileged and confidential information. If you are not the intended recipient of this message (or responsible for delivery of the message to such person) you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error, you should destroy it and kindly notify the sender by reply e-mail. Please advise immediately if you or your employer do not consent to Internet e-mail for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Expert Information Services Pty Ltd ("The Company") shall be understood as neither given nor endorsed by it. The Company advises that this e-mail and any attached files should be scanned to detect viruses. The Company accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. **EIS******** End of Disclaimer ********** |
From: Aapo L. <aap...@pr...> - 2002-12-04 03:10:26
|
> 04:18:56,649 WARN > [JTATransactionFactory] No TransactionManagerLookup configured > (use of JCS read-write cache is not recommended) Ok there is error in documentation (it's not hibernate.transaction.manager_class). This works: hibernate.transaction.manager_lookup_class=cirrus.hibernate.transaction. ResinTransactionManagerLookup Now it works fine!!!!! Great work! Definately the best O/R tool. --- code --- Here is code for ResinTransactionManagerLookup class: package cirrus.hibernate.transaction; public final class ResinTransactionManagerLookup extends JNDITransactionManagerLookup { /** * @see cirrus.hibernate.transaction.JNDITransactionManagerLookup#getName() */ protected String getName() { return "java:comp/TransactionManager"; } } --- code --- |
From: Aapo L. <aap...@pr...> - 2002-12-04 02:37:32
|
> Where are connections coming from? A Hibernate ConnectionProvider? Or > an application supplied connection? They come from JNDI and I use Hibernate XML configuration and initialize Hibernate with configure();. > What guarantees does Maverick make about when / > wether discard() will be called? Is it *guaranteed* > to be called in the case of an exception, etc? Great questions, :-))))))))))))))))))))). Thanks! Now I'm trying to get Transactions to use JTA. The problem is that I get following warnings: 04:18:56,649 WARN [JTATransactionFactory] No TransactionManagerLookup configured (use of JCS read-write cache is not recommended) What is this setting. I get that warning even if I don't use JCS. This is my hibernate.properties: hibernate.use_outer_join=true hibernate.show_sql=false hibernate.jdbc.batch_size=10 hibernate.statement_cache.size=20 hibernate.transaction.factory_class=cirrus.hibernate.transaction.JTATran sactionFactory hibernate.transaction.manager_class=cirrus.hibernate.transaction.JNDITra nsactionManagerLookup hibernate.query.substitutions yes 'Y', no 'N' jta.UserTransaction=java:comp/UserTransaction And here is Hibernate.cfg.xml: <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-co <hibernate-configuration> <session-factory name="java:comp/env/jndi/HibernateSessionFactory"> <property name="connection.datasource">java:comp/env/jdbc/xa/postgresql/something< /property> <property name="dialect">cirrus.hibernate.sql.PostgreSQLDialect</property> ... mapping files ... </session-factory> </hibernate-configuration> Another warning I get with Resin is: 04:18:57,258 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext Should I care about it? |
From: Gavin K. <Gav...@ex...> - 2002-12-04 01:47:19
|
Where are connections coming from? A Hibernate ConnectionProvider? Or an application supplied connection? What guarantees does Maverick make about when / wether discard() will be called? Is it *guaranteed* to be called in the case of an exception, etc? > -----Original Message----- > From: Aapo Laakkonen [mailto:aap...@pr...]=20 > Sent: Thursday, 5 December 2002 12:35 AM > To: hib...@li... > Subject: FW: [Hibernate] Lazy Collections >=20 >=20 > > I had a *really* close look into the possibility > > that Hibernate issues the unclosed session WARNing > > when the session has in fact been closed and I've > > concluded that it doesn't. I am quite certain that > > the problem is that the user is not closing the > > sessions. (In a couple of previous complaints about > > this, that turned out to be the case.) >=20 > Ok it might be my fault (and probably is). Do you see any strange in > this: >=20 > Background: >=20 > - I have extended Maveric Dispatcher so that it loads=20 > Hibernate Session Factory from JNDI and places it in servlet=20 > context. Is that proper thing to do? > - I have abstract controller that every of my maverick=20 > commands extends. > - Abstract controller has 2 methods. getSession() that loads=20 > Session factory from Servlet context and then opens a new=20 > session (if user has already called this.getSession, then it=20 > returns previously opened > session) and places it in class level variable and then=20 > returns it to user. > - User then uses session. > - User does not close session. > - Session is closed in Abstract controller's discard() method=20 > that maverick calls automatically after it has served the=20 > client (e.g. gui is generated). >=20 > The proces goes like this: >=20 > 1. User makes request eg. grid.m that is a maveric command. > 2. Maverick initializes NEW controller (the controller=20 > extends abstract > controller) 3. Then maverick calls execute method. 4. execute=20 > method calls this.getSession.find("whatever") <- lazy=20 > collection 5. execute method returns a string (that is the=20 > view to be rended) 6. Maverick generates a view (view uses=20 > lazy collection) 7. Maverick calls discard (that closes a session) >=20 > The generated HTML (in this case) contains many img tags like this >=20 > <img src=3D"image.m?id=3Dnumber" /> >=20 > So every needed image gets loaded throught Maverick from=20 > database. image.m command opens session as above and after=20 > sending raw data with proper content-type session get's=20 > closed in execute method (Maveric calls discard, but it=20 > doesn't do anything cause session is already closed by=20 > execute command). >=20 > The problem is that I have no idea why Hibernate's=20 > SessionImpl finalize method tries to close connections that I=20 > have already closed (I can output proper log messages when=20 > discard is called). What I have found is that if I don't=20 > close connections in execute method (prior view), then I=20 > sometimes leaves connections open. At least on load testing.=20 > If I don't use lazy collections I do not have this problem. >=20 > > As to the use of finally, cleanup code that *must* > > be executed is *exactly* the role of the finally > > block, as per any Java textbook. And it is > > completely predictable. Method exit cannot occur > > without execution of the finally block. Are you > > sure the redbook wasn't talking about finalize(), > > which *is* unreliable? >=20 > It's quite long time when I read that, and I could have read=20 > it wrong (I checked IBM docs and they all used finally)...=20 > and if I think about it, I agree with you. The errors I get=20 > about unclosed connections, I get them from SessionImpl=20 > finalize(). But problem is not there I think. >=20 > Is it proper to place SessionFactory in servlet context, or=20 > should I always retrieve it from JNDI? I think that JNDI=20 > lookup causes some overhead, so I have put the Session=20 > factory in servlet context. >=20 > When I should use Session.disconnect / reconnect instead open=20 > and close? >=20 > Should I set session to null and should I also check if=20 > session.close returns an open connection? Do I need to close=20 > the connection then manually? Do i need to set connection =3D null? >=20 > Kind Regards > Aapo <b/>ungle Laakkonen >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Microsoft Visual Studio.NET=20 > comprehensive development tool, built to increase your=20 > productivity. Try a free online hosted session at:=20 http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel ********** CAUTION - Disclaimer ********** This message may contain privileged and confidential information. If you are not the intended recipient of this message (or responsible for delivery of the message to such person) you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error, you should destroy it and kindly notify the sender by reply e-mail. Please advise immediately if you or your employer do not consent to Internet e-mail for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Expert Information Services Pty Ltd ("The Company") shall be understood as neither given nor endorsed by it. The Company advises that this e-mail and any attached files should be scanned to detect viruses. The Company accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. **EIS******** End of Disclaimer ********** |
From: Aapo L. <aap...@pr...> - 2002-12-04 01:39:23
|
> I had a *really* close look into the possibility > that Hibernate issues the unclosed session WARNing > when the session has in fact been closed and I've > concluded that it doesn't. I am quite certain that > the problem is that the user is not closing the > sessions. (In a couple of previous complaints about > this, that turned out to be the case.) Ok it might be my fault (and probably is). Do you see any strange in this: Background: - I have extended Maveric Dispatcher so that it loads Hibernate Session Factory from JNDI and places it in servlet context. Is that proper thing to do? - I have abstract controller that every of my maverick commands extends. - Abstract controller has 2 methods. getSession() that loads Session factory from Servlet context and then opens a new session (if user has already called this.getSession, then it returns previously opened session) and places it in class level variable and then returns it to user. - User then uses session. - User does not close session. - Session is closed in Abstract controller's discard() method that maverick calls automatically after it has served the client (e.g. gui is generated). The proces goes like this: 1. User makes request eg. grid.m that is a maveric command. 2. Maverick initializes NEW controller (the controller extends abstract controller) 3. Then maverick calls execute method. 4. execute method calls this.getSession.find("whatever") <- lazy collection 5. execute method returns a string (that is the view to be rended) 6. Maverick generates a view (view uses lazy collection) 7. Maverick calls discard (that closes a session) The generated HTML (in this case) contains many img tags like this <img src="image.m?id=number" /> So every needed image gets loaded throught Maverick from database. image.m command opens session as above and after sending raw data with proper content-type session get's closed in execute method (Maveric calls discard, but it doesn't do anything cause session is already closed by execute command). The problem is that I have no idea why Hibernate's SessionImpl finalize method tries to close connections that I have already closed (I can output proper log messages when discard is called). What I have found is that if I don't close connections in execute method (prior view), then I sometimes leaves connections open. At least on load testing. If I don't use lazy collections I do not have this problem. > As to the use of finally, cleanup code that *must* > be executed is *exactly* the role of the finally > block, as per any Java textbook. And it is > completely predictable. Method exit cannot occur > without execution of the finally block. Are you > sure the redbook wasn't talking about finalize(), > which *is* unreliable? It's quite long time when I read that, and I could have read it wrong (I checked IBM docs and they all used finally)... and if I think about it, I agree with you. The errors I get about unclosed connections, I get them from SessionImpl finalize(). But problem is not there I think. Is it proper to place SessionFactory in servlet context, or should I always retrieve it from JNDI? I think that JNDI lookup causes some overhead, so I have put the Session factory in servlet context. When I should use Session.disconnect / reconnect instead open and close? Should I set session to null and should I also check if session.close returns an open connection? Do I need to close the connection then manually? Do i need to set connection = null? Kind Regards Aapo <b/>ungle Laakkonen |
From: Gavin K. <Gav...@ex...> - 2002-12-03 22:14:31
|
I had a *really* close look into the possibility that Hibernate issues the unclosed session WARNing when the session has in fact been closed and I've concluded that it doesn't. I am quite certain that the problem is that the user is not closing the sessions. (In a couple of previous complaints about this, that turned out to be the case.) As to the use of finally, cleanup code that *must* be executed is *exactly* the role of the finally block, as per any Java textbook. And it is completely predictable. Method exit cannot occur without execution of the finally block. Are you sure the redbook wasn't talking about finalize(), which *is* unreliable? > -----Original Message----- > From: Brad Clow [mailto:bra...@wo...]=20 > Sent: Tuesday, 3 December 2002 9:01 PM > To: Aapo Laakkonen > Cc: hib...@li... > Subject: Re: [Hibernate] Lazy Collections >=20 >=20 > > I have also other problems with lazy collections. I get=20 > WARNings about=20 > > Unclosed Sessions (finalize method in SessionImpl). I use=20 > Maverick Web=20 > > MVC Framework and it has discard() method in one interface that you=20 > > can implement. I have put my Session closing code in it, but it=20 > > doesn't help. It continues to leave sessions open. I have=20 > tried almost=20 > > everything, but I cannot get rid of those Unclosed Sessions. Only=20 > > solution I have found is closing session before going to a view=20 > > rendering phase, and that means that lazy initialization is not an=20 > > option anymore. >=20 > on the project i am currently working on we use a servlet=20 > filter to open a connection in a try block and stick the=20 > close connection in a finally block. we r not having any=20 > probs with lazy initialisation or unclosed sessions. however,=20 > we r also not using the absolute latest version of hibernate. >=20 > > Also I see that Hibernate uses a lot of finally {} blocks=20 > to do some=20 > > cleaning. If I understand correctly, at least what I have read from=20 > > some of IBM's whitepapers, they don't recommend you to use=20 > finally {}=20 > > to do a cleaning (mainly they don't recommend to put connection=20 > > closing code in > > it) as it cannot be determined when that block gets called.=20 > I migth be >=20 > u definitely don't want to rely on finally blocks to clean up=20 > connections, sockets, etc. when it can/should be done some=20 > other way. however, aren't they the last line of defence=20 > when u r relying on someone else to clean up > after themselves? for example, only the developer of the=20 > client app knows > when they r finished with a session and therefore when to close it. >=20 > regards > brad >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Get the new Palm Tungsten T=20 > handheld. Power & Color in a compact size!=20 > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en > _______________________________________________ > hibernate-devel mailing list hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel >=20 ********** CAUTION - Disclaimer ********** This message may contain privileged and confidential information. If you are not the intended recipient of this message (or responsible for delivery of the message to such person) you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error, you should destroy it and kindly notify the sender by reply e-mail. Please advise immediately if you or your employer do not consent to Internet e-mail for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Expert Information Services Pty Ltd ("The Company") shall be understood as neither given nor endorsed by it. The Company advises that this e-mail and any attached files should be scanned to detect viruses. The Company accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. **EIS******** End of Disclaimer ********** |
From: Gavin K. <Gav...@ex...> - 2002-12-03 22:07:19
|
I agree. Furthermore there are some serious conceptual problems with regards to ensuring transaction isolation and also potential performance problems if a single task required multiple connections to the database. -----Original Message----- From: Max Rydahl Andersen [mailto:ma...@eo...]=20 Sent: Tuesday, 3 December 2002 10:59 PM To: Jonas Van Poucke; Hibernate Developers Subject: Re: [Hibernate] Lazy Collections No! If an session has been closed forcefully or by other means, hibernate internals should not reopen the session - at least not per default! If the session has been closed there is a reason for it - one might be to ensure that the ui-layer does not accidently fetches data by "dotting" around in the object graph. If you want the session to be (re)opend - why don't you just keep the session open ? /max ----- Original Message ----- From: "Jonas Van Poucke" <jvp...@ti...> To: "Hibernate Developers" <hib...@li...> Sent: Tuesday, December 03, 2002 9:20 AM Subject: [Hibernate] Lazy Collections The implementation of the write() method in cirrus.hibernate.collections.PersistentCollection states: protected final void write() { initialize(true); if ( session!=3Dnull && session.isOpen() ) session.dirty(this); } This means the session needs to be open. Also, the Docs mentions that lazy collections need to have an open session. Could we safely modify the code to reopen the session when needed? protected final void write() { initialize(true); if ( session !=3D null ) { if ( session.isOpen() ) { session.dirty(this); } else { // Re-open session session.reopen(); // ommitted try-catch session.dirty(this); } } } ************************************************************************ **** *** Hou uw internetverbruik beter onder controle ... surf met Tiscali Complete .... http://tiscali.complete.be ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T=20 handheld. Power & Color in a compact size!=20 http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel ********** CAUTION - Disclaimer ********** This message may contain privileged and confidential information. If you are not the intended recipient of this message (or responsible for delivery of the message to such person) you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error, you should destroy it and kindly notify the sender by reply e-mail. Please advise immediately if you or your employer do not consent to Internet e-mail for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Expert Information Services Pty Ltd ("The Company") shall be understood as neither given nor endorsed by it. The Company advises that this e-mail and any attached files should be scanned to detect viruses. The Company accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. **EIS******** End of Disclaimer ********** |
From: Max R. A. <ma...@eo...> - 2002-12-03 11:58:55
|
No! If an session has been closed forcefully or by other means, hibernate internals should not reopen the session - at least not per default! If the session has been closed there is a reason for it - one might be to ensure that the ui-layer does not accidently fetches data by "dotting" around in the object graph. If you want the session to be (re)opend - why don't you just keep the session open ? /max ----- Original Message ----- From: "Jonas Van Poucke" <jvp...@ti...> To: "Hibernate Developers" <hib...@li...> Sent: Tuesday, December 03, 2002 9:20 AM Subject: [Hibernate] Lazy Collections The implementation of the write() method in cirrus.hibernate.collections.PersistentCollection states: protected final void write() { initialize(true); if ( session!=null && session.isOpen() ) session.dirty(this); } This means the session needs to be open. Also, the Docs mentions that lazy collections need to have an open session. Could we safely modify the code to reopen the session when needed? protected final void write() { initialize(true); if ( session != null ) { if ( session.isOpen() ) { session.dirty(this); } else { // Re-open session session.reopen(); // ommitted try-catch session.dirty(this); } } } **************************************************************************** *** Hou uw internetverbruik beter onder controle ... surf met Tiscali Complete ... http://tiscali.complete.be ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en _______________________________________________ hibernate-devel mailing list hib...@li... https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Brad C. <bra...@wo...> - 2002-12-03 10:01:00
|
> I have also other problems with lazy collections. I get WARNings about > Unclosed Sessions (finalize method in SessionImpl). I use Maverick Web > MVC Framework and it has discard() method in one interface that you can > implement. I have put my Session closing code in it, but it doesn't > help. It continues to leave sessions open. I have tried almost > everything, but I cannot get rid of those Unclosed Sessions. Only > solution I have found is closing session before going to a view > rendering phase, and that means that lazy initialization is not an > option anymore. on the project i am currently working on we use a servlet filter to open a connection in a try block and stick the close connection in a finally block. we r not having any probs with lazy initialisation or unclosed sessions. however, we r also not using the absolute latest version of hibernate. > Also I see that Hibernate uses a lot of finally {} blocks to do some > cleaning. If I understand correctly, at least what I have read from some > of IBM's whitepapers, they don't recommend you to use finally {} to do a > cleaning (mainly they don't recommend to put connection closing code in > it) as it cannot be determined when that block gets called. I migth be u definitely don't want to rely on finally blocks to clean up connections, sockets, etc. when it can/should be done some other way. however, aren't they the last line of defence when u r relying on someone else to clean up after themselves? for example, only the developer of the client app knows when they r finished with a session and therefore when to close it. regards brad |
From: Aapo L. <aap...@pr...> - 2002-12-03 08:47:41
|
> The implementation of the write() method in > cirrus.hibernate.collections.PersistentCollection > states: > > This means the session needs to be open. > Also, the Docs mentions that lazy collections > need to have an open session. Gavin: I have also other problems with lazy collections. I get WARNings about Unclosed Sessions (finalize method in SessionImpl). I use Maverick Web MVC Framework and it has discard() method in one interface that you can implement. I have put my Session closing code in it, but it doesn't help. It continues to leave sessions open. I have tried almost everything, but I cannot get rid of those Unclosed Sessions. Only solution I have found is closing session before going to a view rendering phase, and that means that lazy initialization is not an option anymore. Also I see that Hibernate uses a lot of finally {} blocks to do some cleaning. If I understand correctly, at least what I have read from some of IBM's whitepapers, they don't recommend you to use finally {} to do a cleaning (mainly they don't recommend to put connection closing code in it) as it cannot be determined when that block gets called. I migth be wrong, but I can get the article if you like (?). Any ideas? Do you want the example code that leaves connections some times open (ie. under load)? For resin users: You should enable... <ignore-client-disconnect>true</ignore-client-disconnect> ... if you don't, you are going to get potential problems. i.e. resin starts executing the code, but meanwhile client disconnects and resin recognices that and then immediately stops code execution (you can demonstrate this by yourself by using e.g. Internet Explorer and then hit a page and push F5 key down for about 15 seconds). What this means in practice is that if you close connections after serving client, then that code never gets executed -> you are going to run out of db connections that you have in some pool (i.e. jndi). I think that this settings should be put in some FAQ. Kind Regards Aapo Laakkonen |
From: Jonas V. P. <jvp...@ti...> - 2002-12-03 08:21:08
|
The implementation of the write() method in cirrus.hibernate.collections.= PersistentCollection states: protected final void write() { initialize(true); if ( session!=3Dnull && session.isOpen() ) session.dirty(this); } This means the session needs to be open. Also, the Docs mentions that lazy collections need to have an open sessio= n. Could we safely modify the code to reopen the session when needed? protected final void write() { initialize(true); if ( session !=3D null ) { if ( session.isOpen() ) { session.dirty(this); } else { // Re-open session session.reopen(); // ommitted try-catch session.dirty(this); } } } *************************************************************************= ****** Hou uw internetverbruik beter onder controle ... surf met Tiscali Complet= e ... http://tiscali.complete.be |
From: Gavin K. <Gav...@ex...> - 2002-12-03 06:48:20
|
>Hmm - isn't this idiom inefficient ? >Doesn't parent.getChildren().add() (or any method on the collection) result >in loading all the children ? I am planning to make same small changes so that add() and remove() *don't* force initialization of a readonly=3D"true" collection. I should have done this a while ago.... =20 >If the only intention is to add the child to the parent shouldn't the >child.setParent(parent) be enough ? Not if the many-valued end has cascades. ********** CAUTION - Disclaimer ********** This message may contain privileged and confidential information. If you are not the intended recipient of this message (or responsible for delivery of the message to such person) you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error, you should destroy it and kindly notify the sender by reply e-mail. Please advise immediately if you or your employer do not consent to Internet e-mail for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Expert Information Services Pty Ltd ("The Company") shall be understood as neither given nor endorsed by it. The Company advises that this e-mail and any attached files should be scanned to detect viruses. The Company accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. **EIS******** End of Disclaimer ********** |
From: Gavin K. <Gav...@ex...> - 2002-12-03 06:42:24
|
Well, it works, as far as I know. All you would have to do would be to edit the DTD to accept the 'readonly' attribute on the <list> element. I havn't done this, because of how difficult it would be for me to explain to new users how the list index must map to the same column as a property of the element class ... I spend anough time trying to explain the meaning of <index> as it is. > that reminds me of something: is there bidirectional association support=20 > for List types? I can't seem to find it (it's there for sets and bags). ********** CAUTION - Disclaimer ********** This message may contain privileged and confidential information. If you are not the intended recipient of this message (or responsible for delivery of the message to such person) you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error, you should destroy it and kindly notify the sender by reply e-mail. Please advise immediately if you or your employer do not consent to Internet e-mail for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Expert Information Services Pty Ltd ("The Company") shall be understood as neither given nor endorsed by it. The Company advises that this e-mail and any attached files should be scanned to detect viruses. The Company accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. **EIS******** End of Disclaimer ********** |
From: Jozsa K. <dy...@on...> - 2002-12-01 18:53:50
|
On Sun, Dec 01, 2002 at 10:44:33AM +1100, Gavin King wrote: > P.S. I'm not keen on the way you add items to bidirectional association. The > correct idiom is: > > parent.getChildren().add(child); //yes, even if the children collection is > readonly="true" > child.setParent(parent); > sess.save(child); > > omitting the first line could cause bugs in more complicated circumstances. So exactly what could happen if we use a bidirectional relationship without setting one way read-only and set both sides of the relationship explicitly? I believe I'm just doing that and *never* experienced any problems. Beside that, I feel it quite an overhead doing all this manually, so I'd like to know about both the drawbacks, the dangers, and why that's all unavoidable doing so, or why it cannot happen automatically in the background.. thanks for the explanation in advance, dyn -- .Digital.Yearning.for.Networked.Assassination.and.Xenocide |
From: Juozas B. <ba...@ce...> - 2002-12-01 15:13:21
|
It can be a problem in "transient state": Parent p = new Parent(); Child c = new Child(); c.setParent(p); assertTrue("parent must have a child", p.getChildren() != 0 ); there are two possible solutions : 1) implement "void setParent(Parent p){ this.p = p; p.getChildren().add(this); }" manualy; 2) code generation and "abstract" managed methods ( "transparence" ). I prefer "transparence", but it needs "Factory" if implementation is generated at runtime or JDO style postprocessing if "new" is used to create transient instances. ----- Original Message ----- From: "Max Rydahl Andersen" <ma...@eo...> To: "hibernate list" <hib...@li...> Sent: Sunday, December 01, 2002 4:26 PM Subject: Re: [Hibernate] Hibernate vs. Castor example > > P.S. I'm not keen on the way you add items to bidirectional association. > The > > correct idiom is: > > > > parent.getChildren().add(child); file://yes, even if the children > collection is > > readonly="true" > > child.setParent(parent); > > sess.save(child); > > > > omitting the first line could cause bugs in more complicated > circumstances. > > Hmm - isn't this idiom inefficient ? > Doesn't parent.getChildren().add() (or any method on the collection) result > in loading all the children ? > > If the only intention is to add the child to the parent shouldn't the > child.setParent(parent) be enough ? > > And then if I wish to have the parent in a "correct" state then I just do a > s.load(parent, parent.getId()) ? > > /max > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Dave J. <sno...@nc...> - 2002-12-01 14:59:54
|
I made a number of small changes to get my example working on HSQL with cascading deletes, then when I switched back to MySQL cascading deletes worked there as well! So yes, cascading deletes work on MySQL. I'd like my example to be using Hybernate in the best way possible (under the constraints of DAO), so if you guys see any other problems in my code please let me know. I'll post a revised version once I get more feedback from the Castor folks. Thanks for your help. - Dave David M. Johnson wrote: > I tried adding the cascade="delete" attribute that you mentioned and > the parent.getChildren().add(child) idiom, but when I did I got some > strange behavior. When the removeObject(feed) call was made, the > Newsfeed was deleted by the Items that refer to the feed were not > deleted. Instead, all of the items had their newsfeed_id fields cleared. > > I'm on MySQL, does cascading delete work on MySQL? > > - Dave > |
From: Max R. A. <ma...@eo...> - 2002-12-01 14:26:52
|
> P.S. I'm not keen on the way you add items to bidirectional association. The > correct idiom is: > > parent.getChildren().add(child); file://yes, even if the children collection is > readonly="true" > child.setParent(parent); > sess.save(child); > > omitting the first line could cause bugs in more complicated circumstances. Hmm - isn't this idiom inefficient ? Doesn't parent.getChildren().add() (or any method on the collection) result in loading all the children ? If the only intention is to add the child to the parent shouldn't the child.setParent(parent) be enough ? And then if I wish to have the parent in a "correct" state then I just do a s.load(parent, parent.getId()) ? /max |
From: Paul S. <pau...@ne...> - 2002-12-01 02:46:52
|
Hi, that reminds me of something: is there bidirectional association support for List types? I can't seem to find it (it's there for sets and bags). Regards, PaulS. > > P.S. I'm not keen on the way you add items to bidirectional association. The > correct idiom is: > > parent.getChildren().add(child); //yes, even if the children collection is > readonly="true" > child.setParent(parent); > sess.save(child); > |
From: David M. J. <dav...@nc...> - 2002-12-01 01:31:09
|
I tried adding the cascade="delete" attribute that you mentioned and the parent.getChildren().add(child) idiom, but when I did I got some strange behavior. When the removeObject(feed) call was made, the Newsfeed was deleted by the Items that refer to the feed were not deleted. Instead, all of the items had their newsfeed_id fields cleared. I'm on MySQL, does cascading delete work on MySQL? - Dave Gavin King wrote: >Looking over the source, I'm wondering about a comment in HibeAggregatorDAO > > // if cascade worked, we could just do this > //removeObject(feed); > >this is followed by: > >ses.delete( "select newsfeed.subscriptions.elements " > +"from newsfeed in class ag.Newsfeed" ) > >which should be > >ses.delete( "select newsfeed.subscriptions.elements " > +"from newsfeed in class ag.Newsfeed " > +"where newsfeed = ?", > feed, Hibernate.association(feed) ); > >but you wouldn't need that whole line if you had: > > <set role="subscriptions" table="subscription" cascade="delete"> > <key column="newsfeed_id" length="32" /> > <one-to-many class="ag.Subscription" /> > </set> > >in the mapping...... > > >P.S. I'm not keen on the way you add items to bidirectional association. The >correct idiom is: > >parent.getChildren().add(child); //yes, even if the children collection is >readonly="true" >child.setParent(parent); >sess.save(child); > >omitting the first line could cause bugs in more complicated circumstances. > >----- Original Message ----- >From: "David M. Johnson" <dav...@nc...> >To: <hib...@li...> >Sent: Sunday, December 01, 2002 1:29 AM >Subject: [Hibernate] Hibernate vs. Castor example > > > > >>I've written a simple example application that shows how >>to create a simple web application (a newsfeed aggregator) >>with a pluggable persistence layer. I used the tried >>and true DAO pattern to hide the database access >>mechanism from the rest of the application. >>I implemented the DAO interface with both Hibernate >>and Castor. >> >>I did this to learn: >> >>- What are the drawbacks of hiding powerful persistence >>engine behind a simple DAO interface. What do you loose? >>Will long transaction support work? What about lazy loading? >> >>- What are the differences between and strenghts/weaknesses >>of Castor and Hibernate? >> >>- What is the best way to implement DAO with each of >>the tools. >> >>The code is very simple and (I hope) easy to follow, >>so if you have a chance please take a look. Look at the >>HibeAggregatorDAO and CastorAggregatorDAO implementations >>to see how I used Hiberate and Castor to implement the >>very same DAO. I'd love to get your opinions on the >>above topics. >> >>The readme is here: >>http://sourceforge.net/project/shownotes.php?release_id=125110 >> >>The download is here: >>http://sourceforge.net/project/showfiles.php?group_id=47722 >> >> >>Thanks, >>- Dave >> >>http://www.rollerweblogger.org/page/roller >> >> >> >> >> >> >>------------------------------------------------------- >>This SF.net email is sponsored by: Get the new Palm Tungsten T >>handheld. Power & Color in a compact size! >>http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en >>_______________________________________________ >>hibernate-devel mailing list >>hib...@li... >>https://lists.sourceforge.net/lists/listinfo/hibernate-devel >> >> > > > > |
From: Gavin K. <ga...@ap...> - 2002-11-30 23:46:30
|
Looking over the source, I'm wondering about a comment in HibeAggregatorDAO // if cascade worked, we could just do this //removeObject(feed); this is followed by: ses.delete( "select newsfeed.subscriptions.elements " +"from newsfeed in class ag.Newsfeed" ) which should be ses.delete( "select newsfeed.subscriptions.elements " +"from newsfeed in class ag.Newsfeed " +"where newsfeed = ?", feed, Hibernate.association(feed) ); but you wouldn't need that whole line if you had: <set role="subscriptions" table="subscription" cascade="delete"> <key column="newsfeed_id" length="32" /> <one-to-many class="ag.Subscription" /> </set> in the mapping...... P.S. I'm not keen on the way you add items to bidirectional association. The correct idiom is: parent.getChildren().add(child); //yes, even if the children collection is readonly="true" child.setParent(parent); sess.save(child); omitting the first line could cause bugs in more complicated circumstances. ----- Original Message ----- From: "David M. Johnson" <dav...@nc...> To: <hib...@li...> Sent: Sunday, December 01, 2002 1:29 AM Subject: [Hibernate] Hibernate vs. Castor example > > I've written a simple example application that shows how > to create a simple web application (a newsfeed aggregator) > with a pluggable persistence layer. I used the tried > and true DAO pattern to hide the database access > mechanism from the rest of the application. > I implemented the DAO interface with both Hibernate > and Castor. > > I did this to learn: > > - What are the drawbacks of hiding powerful persistence > engine behind a simple DAO interface. What do you loose? > Will long transaction support work? What about lazy loading? > > - What are the differences between and strenghts/weaknesses > of Castor and Hibernate? > > - What is the best way to implement DAO with each of > the tools. > > The code is very simple and (I hope) easy to follow, > so if you have a chance please take a look. Look at the > HibeAggregatorDAO and CastorAggregatorDAO implementations > to see how I used Hiberate and Castor to implement the > very same DAO. I'd love to get your opinions on the > above topics. > > The readme is here: > http://sourceforge.net/project/shownotes.php?release_id=125110 > > The download is here: > http://sourceforge.net/project/showfiles.php?group_id=47722 > > > Thanks, > - Dave > > http://www.rollerweblogger.org/page/roller > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Get the new Palm Tungsten T > handheld. Power & Color in a compact size! > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Joseph P. <joe...@ho...> - 2002-11-30 22:54:10
|
This release adds image uploads and downloads. You can now upload/download image files individually or in bulk archives (zip). When uploading a zip archive, pixory automatically unzips the archive and makes the pictures available. It's available here: www.pixory.org About Pixory: Pixory is a "personal image server" written with hsqldb. Pixory is an image (photo) management and sharing application, with the emphasis on sharing. It is a purely web-based application, meaning the only interface to the system is html. Pixory allows an author, with minimal or no work, to create a photo album and share it over the internet, directly from his/her own computer without the need for central servers. Joseph Panico joe...@ho... _________________________________________________________________ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail |
From: David M. J. <dav...@nc...> - 2002-11-30 15:42:32
|
I've written a simple example application that shows how to create a simple web application (a newsfeed aggregator) with a pluggable persistence layer. I used the tried and true DAO pattern to hide the database access mechanism from the rest of the application. I implemented the DAO interface with both Hibernate and Castor. I did this to learn: - What are the drawbacks of hiding powerful persistence engine behind a simple DAO interface. What do you loose? Will long transaction support work? What about lazy loading? - What are the differences between and strenghts/weaknesses of Castor and Hibernate? - What is the best way to implement DAO with each of the tools. The code is very simple and (I hope) easy to follow, so if you have a chance please take a look. Look at the HibeAggregatorDAO and CastorAggregatorDAO implementations to see how I used Hiberate and Castor to implement the very same DAO. I'd love to get your opinions on the above topics. The readme is here: http://sourceforge.net/project/shownotes.php?release_id=125110 The download is here: http://sourceforge.net/project/showfiles.php?group_id=47722 Thanks, - Dave http://www.rollerweblogger.org/page/roller |