Re: Using Hibernate via Java, not Flow

2005-04-19 Thread Johannes Textor
Yeah, the problem I have is that I may call 5 different methods on 3 different hibernate wrapper classes in Flow, all of which use the hibernate session. So I'd need a sort of "global" session that only gets opened the first time one of the classes is called, then gets closed by the filter. OK

Re: Using Hibernate via Java, not Flow

2005-04-19 Thread Brent Johnson
> Actually, when putting all the Hibernate stuff into java you would write > some kind of wrapper class to handle all the transactions, so that there > would be no need to have the session as a global variable. > > To be sincere, I think you do not need it anyway ... I was just to lazy to > pass "

Re: Using Hibernate via Java, not Flow

2005-04-19 Thread Johannes Textor
Actually, when putting all the Hibernate stuff into java you would write some kind of wrapper class to handle all the transactions, so that there would be no need to have the session as a global variable. To be sincere, I think you do not need it anyway ... I was just to lazy to pass "hs" as an arg

Re: Using Hibernate via Java, not Flow

2005-04-19 Thread Brent Johnson
nal Message- > > From: Brent Johnson [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, 19 April 2005 6:32 a.m. > > To: users@cocoon.apache.org > > Subject: Re: Using Hibernate via Java, not Flow > > > > > > Is there a way to use the filter approach to closing

Re: Using Hibernate via Java, not Flow

2005-04-19 Thread Brent Johnson
gt; processed. > > > -Original Message- > > From: Brent Johnson [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, 19 April 2005 6:32 a.m. > > To: users@cocoon.apache.org > > Subject: Re: Using Hibernate via Java, not Flow > > > > > > Is there a

RE: Using Hibernate via Java, not Flow

2005-04-18 Thread Adam Ratcliffe
ilto:[EMAIL PROTECTED] > Sent: Tuesday, 19 April 2005 6:32 a.m. > To: users@cocoon.apache.org > Subject: Re: Using Hibernate via Java, not Flow > > > Is there a way to use the filter approach to closing hibernate > sessions without using Spring? I'd rather not intro

Re: Using Hibernate via Java, not Flow

2005-04-18 Thread Brent Johnson
Is there a way to use the filter approach to closing hibernate sessions without using Spring? I'd rather not introduce a whole new framework this late into the development cycle. Is it possible to use Hibernate with Cocoon without Spring, but still encapsulating all Hibernate calls in Java object

Re: Using Hibernate via Java, not Flow

2005-04-14 Thread Brent Johnson
I'll definitely take a look at this closer next week. After doing some reading it looks like using a Filter is really the only way to go at this point. As for Jakub's example, I'm using sendPageAndWait() so I don't know if that makes a difference or not. But as I mentioned before, I definitely d

Re: Using Hibernate via Java, not Flow

2005-04-14 Thread Jakub Kaniewski
JD Daniels wrote: I didn't see the need for a cocoon component. I looked again, but still can't find the article that got me going... basically here is my setup: I use cocoon component put method, that gets JDBC connection from cocoon pool. My flow looks like described in article : function ope

Re: Using Hibernate via Java, not Flow

2005-04-14 Thread JD Daniels
I didn't see the need for a cocoon component. I looked again, but still can't find the article that got me going... basically here is my setup: web.xml: contextConfigLocation WEB-INF/ApplicationContext.xml OpenSessionInViewFilter org.springframework.orm.hi

Re: Using Hibernate via Java, not Flow

2005-04-14 Thread Jakub Kaniewski
Brent Johnson wrote: I searched the Wiki for "servletfilter", "servlet-filter", "servlet filter" and didn't find anything. Is there an example of closing Hibernate sessions using a servlet filter on the Wiki? Here is the wiki article I mentioned before - http://wiki.apache.org/cocoon/CocoonAnd

Re: Using Hibernate via Java, not Flow

2005-04-14 Thread Jakub Kaniewski
beyanet.com wrote: I use hibernate within JBoss 4 as follows: InitialContext ctx = new InitialContext(); sessionfactory = (SessionFactory)ctx.lookup("java:/hibernate/SessionFactory"); session = sessionfactory.openSession(); transaction = session.begin

Re: Using Hibernate via Java, not Flow

2005-04-14 Thread Leszek Gawron
Brent Johnson wrote: So can I just use the OpenSessionInViewFilter class from the Spring framework without having to implement and/or use the complete framework? I'm giving a demo today of the web application so I'm taking out all my hibernate session closes, and I'll just tiptoe around the app to

Re: Using Hibernate via Java, not Flow

2005-04-14 Thread Brent Johnson
So can I just use the OpenSessionInViewFilter class from the Spring framework without having to implement and/or use the complete framework? I'm giving a demo today of the web application so I'm taking out all my hibernate session closes, and I'll just tiptoe around the app to make sure I don't ac

Re: Using Hibernate via Java, not Flow

2005-04-14 Thread Leszek Gawron
Brent Johnson wrote: I searched the Wiki for "servletfilter", "servlet-filter", "servlet filter" and didn't find anything. Is there an example of closing Hibernate sessions using a servlet filter on the Wiki? I checked out the link someone posted earlier, and it describes using a class in the Spri

Re: Using Hibernate via Java, not Flow

2005-04-14 Thread Brent Johnson
I searched the Wiki for "servletfilter", "servlet-filter", "servlet filter" and didn't find anything. Is there an example of closing Hibernate sessions using a servlet filter on the Wiki? I checked out the link someone posted earlier, and it describes using a class in the Spring framework to hand

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread Brent Johnson
Yeah this is exactly the problem I'm having.  If I close the session and then call sendPageAndWait() I get the LazyInitializationException.  So it's been difficult for me to decide exactly where I should close the session.  But this is why I can't figure where to make the close call. For example:

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread beyanet.com
beyanet.com wrote: Brent, the way I use hibernate with flowscript is to simply call the method from flowscript and allow the java method to handle all transaction-session open and closing processes. I place no hibernate code in cocoon. All the hibernate code is self contained within the java me

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread Jakub Kaniewski
beyanet.com wrote: Brent, the way I use hibernate with flowscript is to simply call the method from flowscript and allow the java method to handle all transaction-session open and closing processes. I place no hibernate code in cocoon. All the hibernate code is self contained within the java me

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread beyanet.com
Well, I tried adding in a hibernate close to get around the issue of two different sessions monkeying around with the POJO objects, causing an exception to be thrown (and when those get thrown the whole application flakes out). Brent, the way I use hibernate with flowscript is to simply call th

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread JD Daniels
I use the open Session in view model. The session lasts the duration of the request. I can't find the article I used to get up to speed on it, but this should get you going: http://www.jroller.com/page/cardsharp/Weblog/open_session_in_view_pattern?catname= Brent Johnson wrote: Well, I tried addi

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread JD Daniels
This is also a good idea because it ensures that you won't try to access a session that has already been closed, which seemed to happen to me quite a bit using the hibernate methods in flow. the following works very well: // Global Data Access Objects var appCtx = cocoon.context.getAttribute(We

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread Brent Johnson
Well, I tried adding in a hibernate close to get around the issue of two different sessions monkeying around with the POJO objects, causing an exception to be thrown (and when those get thrown the whole application flakes out). But, I'm running into a "chicken-or-the-egg" problem.  If I close the

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread Leszek Gawron
Brent Johnson wrote: Yeah, it just didn't feel right accessing the Hibernate calls directly from flow. I've heard a lot about Spring, so it works well with Cocoon and Hibernate? What kind of learning curve? I'm about halfway through this project which has a development end date in about 2 wee

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread Brent Johnson
Yeah, it just didn't feel right accessing the Hibernate calls directly from flow.  I've heard a lot about Spring, so it works well with Cocoon and Hibernate?  What kind of learning curve?  I'm about halfway through this project which has a development end date in about 2 weeks.  I've got the POJO o

Re: Using Hibernate via Java, not Flow

2005-04-13 Thread Leszek Gawron
Brent Johnson wrote: This is probably a simple question. I've read the Wiki about using Hibernate and most of that uses Hibernate directly in Flow. I'd rather not do that. I've created some "Wrapper" type classes that are intended to be used from Flow, and they handle the hibernate sessions.

Using Hibernate via Java, not Flow

2005-04-13 Thread Brent Johnson
This is probably a simple question.  I've read the Wiki about using Hibernate and most of that uses Hibernate directly in Flow.  I'd rather not do that.  I've created some "Wrapper" type classes that are intended to be used from Flow, and they handle the hibernate sessions.  All they really do is r