RE: struts2 & hibernate
> -Original Message- > From: Dave Newton [mailto:davelnew...@gmail.com] > Sent: Sunday, May 15, 2011 19:31 > To: Struts Users Mailing List > Subject: Re: struts2 & hibernate > > On Sun, May 15, 2011 at 6:46 PM, Saeed Najahi > wrote: > > code that implicates hibernate and struts, the > documentation doesn't > > help much unfortunatly, explanation or indication of what > version of > > what jar is needed isn't mentioned, > > Dependencies should be managed by Maven (or similar), not by > hand--anything but the *most* basic S2 application (in other > words, no plugins, pretty much no anything) ups the library > requirements pretty quickly. > > In any case, did you look at the S2 "blank" app included in > the main distro? Often times looking at the artifacts > included in a download provide clues regarding library usage. > The blank app includes the following libraries: > > WEB-INF/lib/asm-3.1.jar > WEB-INF/lib/asm-commons-3.1.jar > WEB-INF/lib/asm-tree-3.1.jar > WEB-INF/lib/commons-fileupload-1.2.2.jar > WEB-INF/lib/commons-io-2.0.1.jar > WEB-INF/lib/commons-lang-2.5.jar > WEB-INF/lib/freemarker-2.3.16.jar > WEB-INF/lib/javassist-3.11.0.GA.jar > WEB-INF/lib/ognl-3.0.1.jar > WEB-INF/lib/struts2-core-2.2.3.jar > WEB-INF/lib/xwork-core-2.2.3.jar > > > (in addition to the full hibernate plugin) > > There is no Hibernate plugin. > > Since you don't provide any information regarding the errors > you're getting, it's difficult to help much more than that. For what it is worth, we are using hibernate 3.6.x w/ annotations in struts 2.1.6, 2.1.8, 2.2.x, and SVN HEAD Using the convention and portlet plugins. Please post example of failure for debugging. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100- - +1 (443) 269-1555 x333Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2 & hibernate
On Sun, May 15, 2011 at 6:46 PM, Saeed Najahi wrote: > code that implicates hibernate and struts, the documentation doesn't help > much unfortunatly, explanation or indication of what version of what jar is > needed isn't mentioned, Dependencies should be managed by Maven (or similar), not by hand--anything but the *most* basic S2 application (in other words, no plugins, pretty much no anything) ups the library requirements pretty quickly. In any case, did you look at the S2 "blank" app included in the main distro? Often times looking at the artifacts included in a download provide clues regarding library usage. The blank app includes the following libraries: WEB-INF/lib/asm-3.1.jar WEB-INF/lib/asm-commons-3.1.jar WEB-INF/lib/asm-tree-3.1.jar WEB-INF/lib/commons-fileupload-1.2.2.jar WEB-INF/lib/commons-io-2.0.1.jar WEB-INF/lib/commons-lang-2.5.jar WEB-INF/lib/freemarker-2.3.16.jar WEB-INF/lib/javassist-3.11.0.GA.jar WEB-INF/lib/ognl-3.0.1.jar WEB-INF/lib/struts2-core-2.2.3.jar WEB-INF/lib/xwork-core-2.2.3.jar > (in addition to the full hibernate plugin) There is no Hibernate plugin. Since you don't provide any information regarding the errors you're getting, it's difficult to help much more than that. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts2 & hibernate
hello guys, plz i need some help concerning struts 2.2.3 and hibernate 3.6.3, the problem i'm having is that the jars seem to keep fighting with each other :( exceptions that stop me from even daring to write a single line of code that implicates hibernate and struts, the documentation doesn't help much unfortunatly, explanation or indication of what version of what jar is needed isn't mentioned, i've never even thought that javassist was needed untill i downloaded a struts project from google code, there was no mentioning of it whatsoever in the tutorial would anyone kindly give me a pom.xml of a working struts2 and hibernate project (in addition to the full hibernate plugin), please help me out i'm pretty much depressed right now, thanks in advance guys -- `*The early bird catches the worm, but the second mouse gets the cheese..*` *NAJAHI Saïd* (* KyouJin-SaMa* ) 4ème année G.Info E.N.S.A.Safi -
Re: struts2+hibernate+spring - lazyInitaializationException
hi, thanks for all your help... as it turned out the problem was in my configuration :).. basically one of my service wasn't annotated with @Transaction tag and as a consequence my template was closing the session .. On Mon, Jul 19, 2010 at 8:44 PM, Robert Taylor wrote: > Hi Greg, > > I believe Brian is correct. > > You need to wrap BookDao.find(...) within a transaction or use > OpenSessionInView. > Either one of these should keep the session open when you are navigating > the object graph > in your DAO. If you use OSIV (OpenSessionInView) filter, then you can > navigate the > object graph in your web tier as well. > > We are using both OpenSessionInView filter and a service layer which acts > as a facade to the data layer (DAOs). The services are annotated with > @Transactional (although for readOnly transactions this is really > unnecessary within the OSIV scope; but they are there for consistency). > > /robert > - Original Message - From: "Brian Thompson" > > To: "Struts Users Mailing List" ; < > lukasz.len...@gmail.com> > Sent: Monday, July 19, 2010 1:22 PM > Subject: Re: struts2+hibernate+spring - lazyInitaializationException > > > > Looks to me like the session is being closed in the scope of >> hibernateTemplate.get(). >> >> I don't see a transactionManager mentioned in the XML ... you could >> try adding something like this in the XML configuration file: >> >> > class="org.springframework.orm.hibernate.HibernateTransactionManager"> >> >> >> >> >> >> n.b. I haven't tested the above config, so it probably won't work >> as-is. Hopefully it helps, though. >> >> -Brian >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Greg Stasica
Re: struts2+hibernate+spring - lazyInitaializationException
Hi Greg, I believe Brian is correct. You need to wrap BookDao.find(...) within a transaction or use OpenSessionInView. Either one of these should keep the session open when you are navigating the object graph in your DAO. If you use OSIV (OpenSessionInView) filter, then you can navigate the object graph in your web tier as well. We are using both OpenSessionInView filter and a service layer which acts as a facade to the data layer (DAOs). The services are annotated with @Transactional (although for readOnly transactions this is really unnecessary within the OSIV scope; but they are there for consistency). /robert - Original Message - From: "Brian Thompson" To: "Struts Users Mailing List" ; Sent: Monday, July 19, 2010 1:22 PM Subject: Re: struts2+hibernate+spring - lazyInitaializationException Looks to me like the session is being closed in the scope of hibernateTemplate.get(). I don't see a transactionManager mentioned in the XML ... you could try adding something like this in the XML configuration file: n.b. I haven't tested the above config, so it probably won't work as-is. Hopefully it helps, though. -Brian - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2+hibernate+spring - lazyInitaializationException
hi, thanks for your replies lukasz i'm not sure where the problem exactly is but after my additional test i don't think it's s2 related... i'll try to check hibernate brian i've done tests with your changes but to no avail... still the same problem even when my dao implementation class has a transaction annotation i.e. @Repository("bookBean") @Transactional class BookDaoImpl {. . On Mon, Jul 19, 2010 at 6:22 PM, Brian Thompson wrote: > Looks to me like the session is being closed in the scope of > hibernateTemplate.get(). > > I don't see a transactionManager mentioned in the XML ... you could > try adding something like this in the XML configuration file: > > > class="org.springframework.orm.hibernate.HibernateTransactionManager"> > > > > > > n.b. I haven't tested the above config, so it probably won't work > as-is. Hopefully it helps, though. > > -Brian > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Greg Stasica
Re: struts2+hibernate+spring - lazyInitaializationException
Looks to me like the session is being closed in the scope of hibernateTemplate.get(). I don't see a transactionManager mentioned in the XML ... you could try adding something like this in the XML configuration file: n.b. I haven't tested the above config, so it probably won't work as-is. Hopefully it helps, though. -Brian - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2+hibernate+spring - lazyInitaializationException
Hi, I really don't see how Struts2 can messed it up. Would you try to write a unit test to check that? Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts2+hibernate+spring - lazyInitaializationException
hi, i've been testing very simply scenario using aforementioned technologies but all i get is LazyInitializationException while trying to access my entity collection. I've included some code snippets below to make myself very clear. I don't think there is anything wrong with the attached code as most of the examples i found on the Internet use exactly (at least i haven't seen any differences ) this approach. This makes me believe that somehow s2 works differently here and causes the problem (.. perhaps it's a long shot on my part but perhaps attaching each action to the ThreadLocal is the problem ? Surely it's not a problem of having or not having OpenSessionInViewFilter as the call to hibernate doesn't originate from the view layer (jsp) *Entity* @Entity class Book{ @OneToMany. private List authors; } *DAOImpl* class BookDaoImpl { public Book find(int Id) { Book sv = hibernateTemplate.get(Book.class, Id); //this line works fine sv.getAuthors().size(); //this line throws LazyInitializationException return sv; } @Autowired @Qualifier("sessionFactory") public void setSessionFactory(SessionFactory sessionFactory) { this.hibernateTemplate = new HibernateTemplate(sessionFactory); } } *spring configuration xml* * * .. . org.hibernate.dialect.Oracle10gDialect true *BeanManager - i'm using this class in struts actions to retrieve spring beans as i don't want to use spring object factory shipped with struts2* public class BeanManager { public static synchronized BeanManager getInstance() { if(instance==null) { instance = new BeanManager(); } return instance; } protected BeanManager() { URL url = BeanManager.class.getClassLoader().getResource("applicationContext.xml"); ctx = new FileSystemXmlApplicationContext(url.getPath()); } }
RE: New Struts2/Hibernate/Spring tutorial
Thanks for the kind words, I've updated the sitemesh decorator to use JSTL instead of scriptlets now and it does indeed look neater. Updated project files here: http://splinter.com.au/blog/wp-content/uploads/javastrutshibernatetutori al.zip And updated tutorial here: http://www.scribd.com/doc/25244173/Java-Struts-Hibernate-Tutorial So in the absence of any other feedback, would it be safe to assume I wouldn't be leading our team astray by using this as a learning tutorial? Cheers, Chris -Original Message- From: Kawczynski, David [mailto:david_kawczyn...@merck.com] Sent: Wednesday, 3 February 2010 8:06 AM To: Struts Users Mailing List Subject: RE: New Struts2/Hibernate/Spring tutorial I don't think it is wise to instruct newbies to use scriptles, especially in SiteMesh decorators. The decorator.xml file should instruct SiteMesh to use different decorators for different paths. Newbies need to get started off on the right foot, and not with bad practices. Other then that it's pretty good. Cheers! -dave > -Original Message- > From: Hulbert Chris [mailto:chulb...@woolworths.com.au] > Sent: Tuesday, February 02, 2010 12:32 AM > To: user@struts.apache.org > Subject: New Struts2/Hibernate/Spring tutorial > > Hi all, I've recently been working on a Struts2/Hibernate/Spring > beginners tutorial for some internal training at work, and > was thinking > that perhaps it could have some worth to the greater struts community, > can anyone let me know if theres a site where it would belong > and if you > think it's accurate? Thanks. > > The tutorial can be found here: > http://www.scribd.com/doc/25244173/Java-Struts-Hibernate-Tutorial > > Oh and apologies in advance for my email signature, I can't > do anything > about it... *** CAUTION: This email and files included in its transmission are solely intended for the use of the addressee(s) and may contain information that is confidential and privileged. If you receive this email in error, please advise us immediately and delete it without copying the contents contained within. Woolworths Limited (including its group of companies) do not accept liability for the views expressed within or the consequences of any computer viruses that may be transmitted with this email. The contents are also subject to copyright. No part of it should be reproduced, adapted or transmitted without the written consent of the copyright owner. *** - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: New Struts2/Hibernate/Spring tutorial
I don't think it is wise to instruct newbies to use scriptles, especially in SiteMesh decorators. The decorator.xml file should instruct SiteMesh to use different decorators for different paths. Newbies need to get started off on the right foot, and not with bad practices. Other then that it's pretty good. Cheers! -dave > -Original Message- > From: Hulbert Chris [mailto:chulb...@woolworths.com.au] > Sent: Tuesday, February 02, 2010 12:32 AM > To: user@struts.apache.org > Subject: New Struts2/Hibernate/Spring tutorial > > Hi all, I've recently been working on a Struts2/Hibernate/Spring > beginners tutorial for some internal training at work, and > was thinking > that perhaps it could have some worth to the greater struts community, > can anyone let me know if theres a site where it would belong > and if you > think it's accurate? Thanks. > > The tutorial can be found here: > http://www.scribd.com/doc/25244173/Java-Struts-Hibernate-Tutorial > > Oh and apologies in advance for my email signature, I can't > do anything > about it... > > *** > CAUTION: This email and files included in its transmission > are solely intended for the use of the addressee(s) and may > contain information that is confidential and privileged. > If you receive this email in error, please advise us > immediately and delete it without copying the contents > contained within. Woolworths Limited (including its group > of companies) do not accept liability for the views > expressed within or the consequences of any computer > viruses that may be transmitted with this email. The > contents are also subject to copyright. No part of it > should be reproduced, adapted or transmitted without the > written consent of the copyright owner. > *** > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates Direct contact information for affiliates is available at http://www.merck.com/contact/contacts.html) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
New Struts2/Hibernate/Spring tutorial
Hi all, I've recently been working on a Struts2/Hibernate/Spring beginners tutorial for some internal training at work, and was thinking that perhaps it could have some worth to the greater struts community, can anyone let me know if theres a site where it would belong and if you think it's accurate? Thanks. The tutorial can be found here: http://www.scribd.com/doc/25244173/Java-Struts-Hibernate-Tutorial Oh and apologies in advance for my email signature, I can't do anything about it... *** CAUTION: This email and files included in its transmission are solely intended for the use of the addressee(s) and may contain information that is confidential and privileged. If you receive this email in error, please advise us immediately and delete it without copying the contents contained within. Woolworths Limited (including its group of companies) do not accept liability for the views expressed within or the consequences of any computer viruses that may be transmitted with this email. The contents are also subject to copyright. No part of it should be reproduced, adapted or transmitted without the written consent of the copyright owner. *** - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 / Hibernate Question
Eduard, I am still getting a ClassNotFound error on OpenSessionInViewFilter at startup. I have found two jar files that contain the class, spring.jar and spring-hibernate3.jar, and it fails with both of them. I have configured applicationContext.xml like this: FLUSH_AUTO is there anything else I have neglected to do? Some other configuration, perhaps? --Dennis From: Eduard Neuwirt To: Struts Users Mailing List Sent: Sat, October 24, 2009 2:52:27 AM Subject: Re: Struts2 / Hibernate Question Hm, interesting. I checked against my configurations. I have in my WEB-INF/lib spring.jar, all necessary hibernate archives and the configuration of filters is done as described in the link I already posted. Best Eduard Dennis Atkinson schrieb: > OK, that's good. So -- uh - how would I configure OpenSessionInView? I > attempted to do it, but even after I loaded the spring-hibernate3-2.0.8.jar > file, I got a ClassNotFound error, so I couldn't even get past that. > And you are absolutely correct about it being rather interesting. But it > seems so common, that there should be a common and standard way of dealing > with it, but so far it seems not. > > --Dennis > > > > > > > > From: Eduard Neuwirt > To: Struts Users Mailing List > Sent: Fri, October 23, 2009 3:19:09 PM > Subject: Re: Struts2 / Hibernate Question > > Hi Dennis, > > sorry i don't know anything about FullHibernatePlugin. I am using only the > OpenSessionInView-approach. The Google delivers several threads to this > topic. It seems to be rather interesting problem. > > Regards > Eduard > > Dennis Atkinson schrieb: > >> Eduard, >> >> I thought the FullHibernatePlugin implements this. >> >> --Dennis >> >> >> >> >> >> >> From: Eduard Neuwirt >> To: Struts Users Mailing List >> Sent: Fri, October 23, 2009 3:08:44 PM >> Subject: Re: Struts2 / Hibernate Question >> >> Hi, >> >> please have a look to the https://www.hibernate.org/43.html >> >> Regards >> Eduard >> >> Thomas Sattler schrieb: >> >>> So it sounds like both the FullHibernatePlugin and the >>> OpenSessionInViewFilter class work. Thanks for the quick replies. >>> >>> Do you remember how these are configured? >>> >>> The FullHibernatePlugin wiki says only a few lines of configuration are >>> required, but it doesn't say what those lines are. >>> >>> With OpenSessionInView, I add it to my web.xml file, but I get an error that >>> it can't find the class, even though I am fairly certain that the >>> "spring-hibernate3-2.0.8.jar" file contains it, and I triple-check to make >>> sure that jar is loaded. >>> >>> >>> --Dennis >>> >>> >>> >>> >>> >>> On Fri, Oct 23, 2009 at 2:35 PM, Eduard Neuwirt < >>> eduard.neuw...@googlemail.com> wrote: >>> >>> >>>> Hi, >>>> >>>> Obviously there is a gap between Hibernate and Web-Application. >>>> OpenSessionInViewFilter working well, almost. I am using this filter and in >>>> the most cases it is enough. Sometimes I have to load Collection with >>>> size(). The another solution is to store only keys in the session and load >>>> the objects for every request from the Database/second level cash. The >>>> Eager >>>> Initialization does not work for two or more Lists in the class :( >>>> >>>> Regards >>>> Eduard >>>> >>>> >>>> Dennis Atkinson schrieb: >>>> >>>> Hello all. >>>> >>>>> I am running into the infamous "closed session" issue, whereby I get a >>>>> LazyInitializationException on a lazy-initialized foreign key >>>>> relationship. >>>>> The issue, as I understand it, is that the session is closed before the >>>>> lazy-initialized objects need to be read from the database, so there is no >>>>> session when the read actually occurs, and the exception is thrown. It >>>>> seems like any complex Struts / Hibernate system would eventually run into >>>>> this issue, as I have. I could specify everyth
Re: Struts2 / Hibernate Question
Hm, interesting. I checked against my configurations. I have in my WEB-INF/lib spring.jar, all necessary hibernate archives and the configuration of filters is done as described in the link I already posted. Best Eduard Dennis Atkinson schrieb: OK, that's good. So -- uh - how would I configure OpenSessionInView? I attempted to do it, but even after I loaded the spring-hibernate3-2.0.8.jar file, I got a ClassNotFound error, so I couldn't even get past that. And you are absolutely correct about it being rather interesting. But it seems so common, that there should be a common and standard way of dealing with it, but so far it seems not. --Dennis From: Eduard Neuwirt To: Struts Users Mailing List Sent: Fri, October 23, 2009 3:19:09 PM Subject: Re: Struts2 / Hibernate Question Hi Dennis, sorry i don't know anything about FullHibernatePlugin. I am using only the OpenSessionInView-approach. The Google delivers several threads to this topic. It seems to be rather interesting problem. Regards Eduard Dennis Atkinson schrieb: Eduard, I thought the FullHibernatePlugin implements this. --Dennis From: Eduard Neuwirt To: Struts Users Mailing List Sent: Fri, October 23, 2009 3:08:44 PM Subject: Re: Struts2 / Hibernate Question Hi, please have a look to the https://www.hibernate.org/43.html Regards Eduard Thomas Sattler schrieb: So it sounds like both the FullHibernatePlugin and the OpenSessionInViewFilter class work. Thanks for the quick replies. Do you remember how these are configured? The FullHibernatePlugin wiki says only a few lines of configuration are required, but it doesn't say what those lines are. With OpenSessionInView, I add it to my web.xml file, but I get an error that it can't find the class, even though I am fairly certain that the "spring-hibernate3-2.0.8.jar" file contains it, and I triple-check to make sure that jar is loaded. --Dennis On Fri, Oct 23, 2009 at 2:35 PM, Eduard Neuwirt < eduard.neuw...@googlemail.com> wrote: Hi, Obviously there is a gap between Hibernate and Web-Application. OpenSessionInViewFilter working well, almost. I am using this filter and in the most cases it is enough. Sometimes I have to load Collection with size(). The another solution is to store only keys in the session and load the objects for every request from the Database/second level cash. The Eager Initialization does not work for two or more Lists in the class :( Regards Eduard Dennis Atkinson schrieb: Hello all. I am running into the infamous "closed session" issue, whereby I get a LazyInitializationException on a lazy-initialized foreign key relationship. The issue, as I understand it, is that the session is closed before the lazy-initialized objects need to be read from the database, so there is no session when the read actually occurs, and the exception is thrown. It seems like any complex Struts / Hibernate system would eventually run into this issue, as I have. I could specify everything as "EAGER", but that would (eventually) load my entire database and that's far from an optimal solution. As suggestions for fixing this, I have found references to the FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both claim that no code changes are required, and all that's needed are some configuration changes. The documentation on how to use these two solutions is sparse, at best. Has anyone used either of these two solutions? Is there any documentation floating around that I haven't found yet? Or is there another, better solution that someone has found? I know this is a Hibernate issue and not a Struts issue, but I think people here must have experience with this issue. Thanks in advance, Dennis - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 / Hibernate Question
OK, that's good. So -- uh - how would I configure OpenSessionInView? I attempted to do it, but even after I loaded the spring-hibernate3-2.0.8.jar file, I got a ClassNotFound error, so I couldn't even get past that. And you are absolutely correct about it being rather interesting. But it seems so common, that there should be a common and standard way of dealing with it, but so far it seems not. --Dennis From: Eduard Neuwirt To: Struts Users Mailing List Sent: Fri, October 23, 2009 3:19:09 PM Subject: Re: Struts2 / Hibernate Question Hi Dennis, sorry i don't know anything about FullHibernatePlugin. I am using only the OpenSessionInView-approach. The Google delivers several threads to this topic. It seems to be rather interesting problem. Regards Eduard Dennis Atkinson schrieb: > Eduard, > > I thought the FullHibernatePlugin implements this. > > --Dennis > > > > > > > From: Eduard Neuwirt > To: Struts Users Mailing List > Sent: Fri, October 23, 2009 3:08:44 PM > Subject: Re: Struts2 / Hibernate Question > > Hi, > > please have a look to the https://www.hibernate.org/43.html > > Regards > Eduard > > Thomas Sattler schrieb: > >> So it sounds like both the FullHibernatePlugin and the >> OpenSessionInViewFilter class work. Thanks for the quick replies. >> >> Do you remember how these are configured? >> >> The FullHibernatePlugin wiki says only a few lines of configuration are >> required, but it doesn't say what those lines are. >> >> With OpenSessionInView, I add it to my web.xml file, but I get an error that >> it can't find the class, even though I am fairly certain that the >> "spring-hibernate3-2.0.8.jar" file contains it, and I triple-check to make >> sure that jar is loaded. >> >> >> --Dennis >> >> >> >> >> >> On Fri, Oct 23, 2009 at 2:35 PM, Eduard Neuwirt < >> eduard.neuw...@googlemail.com> wrote: >> >> >> >>> Hi, >>> >>> Obviously there is a gap between Hibernate and Web-Application. >>> OpenSessionInViewFilter working well, almost. I am using this filter and in >>> the most cases it is enough. Sometimes I have to load Collection with >>> size(). The another solution is to store only keys in the session and load >>> the objects for every request from the Database/second level cash. The Eager >>> Initialization does not work for two or more Lists in the class :( >>> >>> Regards >>> Eduard >>> >>> >>> Dennis Atkinson schrieb: >>> >>> Hello all. >>> >>> >>>> I am running into the infamous "closed session" issue, whereby I get a >>>> LazyInitializationException on a lazy-initialized foreign key relationship. >>>> The issue, as I understand it, is that the session is closed before the >>>> lazy-initialized objects need to be read from the database, so there is no >>>> session when the read actually occurs, and the exception is thrown. It >>>> seems like any complex Struts / Hibernate system would eventually run into >>>> this issue, as I have. I could specify everything as "EAGER", but that >>>> would (eventually) load my entire database and that's far from an optimal >>>> solution. >>>> >>>> As suggestions for fixing this, I have found references to the >>>> FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both >>>> claim >>>> that no code changes are required, and all that's needed are some >>>> configuration changes. The documentation on how to use these two solutions >>>> is sparse, at best. >>>> Has anyone used either of these two solutions? Is there any documentation >>>> floating around that I haven't found yet? Or is there another, better >>>> solution that someone has found? >>>> I know this is a Hibernate issue and not a Struts issue, but I think >>>> people here must have experience with this issue. >>>> >>>> Thanks in advance, >>>> Dennis >>>> >>>> >>>> >>>> >>>> >>>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >>> >>> >> >> > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 / Hibernate Question
Hi Dennis, sorry i don't know anything about FullHibernatePlugin. I am using only the OpenSessionInView-approach. The Google delivers several threads to this topic. It seems to be rather interesting problem. Regards Eduard Dennis Atkinson schrieb: Eduard, I thought the FullHibernatePlugin implements this. --Dennis From: Eduard Neuwirt To: Struts Users Mailing List Sent: Fri, October 23, 2009 3:08:44 PM Subject: Re: Struts2 / Hibernate Question Hi, please have a look to the https://www.hibernate.org/43.html Regards Eduard Thomas Sattler schrieb: So it sounds like both the FullHibernatePlugin and the OpenSessionInViewFilter class work. Thanks for the quick replies. Do you remember how these are configured? The FullHibernatePlugin wiki says only a few lines of configuration are required, but it doesn't say what those lines are. With OpenSessionInView, I add it to my web.xml file, but I get an error that it can't find the class, even though I am fairly certain that the "spring-hibernate3-2.0.8.jar" file contains it, and I triple-check to make sure that jar is loaded. --Dennis On Fri, Oct 23, 2009 at 2:35 PM, Eduard Neuwirt < eduard.neuw...@googlemail.com> wrote: Hi, Obviously there is a gap between Hibernate and Web-Application. OpenSessionInViewFilter working well, almost. I am using this filter and in the most cases it is enough. Sometimes I have to load Collection with size(). The another solution is to store only keys in the session and load the objects for every request from the Database/second level cash. The Eager Initialization does not work for two or more Lists in the class :( Regards Eduard Dennis Atkinson schrieb: Hello all. I am running into the infamous "closed session" issue, whereby I get a LazyInitializationException on a lazy-initialized foreign key relationship. The issue, as I understand it, is that the session is closed before the lazy-initialized objects need to be read from the database, so there is no session when the read actually occurs, and the exception is thrown. It seems like any complex Struts / Hibernate system would eventually run into this issue, as I have. I could specify everything as "EAGER", but that would (eventually) load my entire database and that's far from an optimal solution. As suggestions for fixing this, I have found references to the FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both claim that no code changes are required, and all that's needed are some configuration changes. The documentation on how to use these two solutions is sparse, at best. Has anyone used either of these two solutions? Is there any documentation floating around that I haven't found yet? Or is there another, better solution that someone has found? I know this is a Hibernate issue and not a Struts issue, but I think people here must have experience with this issue. Thanks in advance, Dennis - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 / Hibernate Question
Eduard, I thought the FullHibernatePlugin implements this. --Dennis From: Eduard Neuwirt To: Struts Users Mailing List Sent: Fri, October 23, 2009 3:08:44 PM Subject: Re: Struts2 / Hibernate Question Hi, please have a look to the https://www.hibernate.org/43.html Regards Eduard Thomas Sattler schrieb: > So it sounds like both the FullHibernatePlugin and the > OpenSessionInViewFilter class work. Thanks for the quick replies. > > Do you remember how these are configured? > > The FullHibernatePlugin wiki says only a few lines of configuration are > required, but it doesn't say what those lines are. > > With OpenSessionInView, I add it to my web.xml file, but I get an error that > it can't find the class, even though I am fairly certain that the > "spring-hibernate3-2.0.8.jar" file contains it, and I triple-check to make > sure that jar is loaded. > > > --Dennis > > > > > > On Fri, Oct 23, 2009 at 2:35 PM, Eduard Neuwirt < > eduard.neuw...@googlemail.com> wrote: > > >> Hi, >> >> Obviously there is a gap between Hibernate and Web-Application. >> OpenSessionInViewFilter working well, almost. I am using this filter and in >> the most cases it is enough. Sometimes I have to load Collection with >> size(). The another solution is to store only keys in the session and load >> the objects for every request from the Database/second level cash. The Eager >> Initialization does not work for two or more Lists in the class :( >> >> Regards >> Eduard >> >> >> Dennis Atkinson schrieb: >> >> Hello all. >> >>> I am running into the infamous "closed session" issue, whereby I get a >>> LazyInitializationException on a lazy-initialized foreign key relationship. >>> The issue, as I understand it, is that the session is closed before the >>> lazy-initialized objects need to be read from the database, so there is no >>> session when the read actually occurs, and the exception is thrown. It >>> seems like any complex Struts / Hibernate system would eventually run into >>> this issue, as I have. I could specify everything as "EAGER", but that >>> would (eventually) load my entire database and that's far from an optimal >>> solution. >>> >>> As suggestions for fixing this, I have found references to the >>> FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both claim >>> that no code changes are required, and all that's needed are some >>> configuration changes. The documentation on how to use these two solutions >>> is sparse, at best. >>> Has anyone used either of these two solutions? Is there any documentation >>> floating around that I haven't found yet? Or is there another, better >>> solution that someone has found? >>> I know this is a Hibernate issue and not a Struts issue, but I think >>> people here must have experience with this issue. >>> >>> Thanks in advance, >>> Dennis >>> >>> >>> >>> >>> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 / Hibernate Question
Hi, please have a look to the https://www.hibernate.org/43.html Regards Eduard Thomas Sattler schrieb: So it sounds like both the FullHibernatePlugin and the OpenSessionInViewFilter class work. Thanks for the quick replies. Do you remember how these are configured? The FullHibernatePlugin wiki says only a few lines of configuration are required, but it doesn't say what those lines are. With OpenSessionInView, I add it to my web.xml file, but I get an error that it can't find the class, even though I am fairly certain that the "spring-hibernate3-2.0.8.jar" file contains it, and I triple-check to make sure that jar is loaded. --Dennis On Fri, Oct 23, 2009 at 2:35 PM, Eduard Neuwirt < eduard.neuw...@googlemail.com> wrote: Hi, Obviously there is a gap between Hibernate and Web-Application. OpenSessionInViewFilter working well, almost. I am using this filter and in the most cases it is enough. Sometimes I have to load Collection with size(). The another solution is to store only keys in the session and load the objects for every request from the Database/second level cash. The Eager Initialization does not work for two or more Lists in the class :( Regards Eduard Dennis Atkinson schrieb: Hello all. I am running into the infamous "closed session" issue, whereby I get a LazyInitializationException on a lazy-initialized foreign key relationship. The issue, as I understand it, is that the session is closed before the lazy-initialized objects need to be read from the database, so there is no session when the read actually occurs, and the exception is thrown. It seems like any complex Struts / Hibernate system would eventually run into this issue, as I have. I could specify everything as "EAGER", but that would (eventually) load my entire database and that's far from an optimal solution. As suggestions for fixing this, I have found references to the FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both claim that no code changes are required, and all that's needed are some configuration changes. The documentation on how to use these two solutions is sparse, at best. Has anyone used either of these two solutions? Is there any documentation floating around that I haven't found yet? Or is there another, better solution that someone has found? I know this is a Hibernate issue and not a Struts issue, but I think people here must have experience with this issue. Thanks in advance, Dennis - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 / Hibernate Question
Hello Johannes, I am a little bit confusing. I thougth that Spring + Hibernate do not solve the LazyInitializationException-issue because the hibernate session is attached to request scope, so it leads to the problem ? Do you store the session in the session scope ? Regards Eduard Johannes Geppert schrieb: I use the FullHibernatePlugin in some small Projects, this is working very well for me. In larger Projects today I prefer Hibernate in combination with Spring Framework. Best Regards Johannes Geppert -- http://www.jgeppert.com http://twitter.com/jogep Dennis Atkinson wrote: Hello all. I am running into the infamous "closed session" issue, whereby I get a LazyInitializationException on a lazy-initialized foreign key relationship. The issue, as I understand it, is that the session is closed before the lazy-initialized objects need to be read from the database, so there is no session when the read actually occurs, and the exception is thrown. It seems like any complex Struts / Hibernate system would eventually run into this issue, as I have. I could specify everything as "EAGER", but that would (eventually) load my entire database and that's far from an optimal solution. As suggestions for fixing this, I have found references to the FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both claim that no code changes are required, and all that's needed are some configuration changes. The documentation on how to use these two solutions is sparse, at best. Has anyone used either of these two solutions? Is there any documentation floating around that I haven't found yet? Or is there another, better solution that someone has found? I know this is a Hibernate issue and not a Struts issue, but I think people here must have experience with this issue. Thanks in advance, Dennis - --- web: http://www.jgeppert.com twitter: http://twitter.com/jogep - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 / Hibernate Question
So it sounds like both the FullHibernatePlugin and the OpenSessionInViewFilter class work. Thanks for the quick replies. Do you remember how these are configured? The FullHibernatePlugin wiki says only a few lines of configuration are required, but it doesn't say what those lines are. With OpenSessionInView, I add it to my web.xml file, but I get an error that it can't find the class, even though I am fairly certain that the "spring-hibernate3-2.0.8.jar" file contains it, and I triple-check to make sure that jar is loaded. --Dennis On Fri, Oct 23, 2009 at 2:35 PM, Eduard Neuwirt < eduard.neuw...@googlemail.com> wrote: > Hi, > > Obviously there is a gap between Hibernate and Web-Application. > OpenSessionInViewFilter working well, almost. I am using this filter and in > the most cases it is enough. Sometimes I have to load Collection with > size(). The another solution is to store only keys in the session and load > the objects for every request from the Database/second level cash. The Eager > Initialization does not work for two or more Lists in the class :( > > Regards > Eduard > > > Dennis Atkinson schrieb: > > Hello all. >> >> I am running into the infamous "closed session" issue, whereby I get a >> LazyInitializationException on a lazy-initialized foreign key relationship. >> The issue, as I understand it, is that the session is closed before the >> lazy-initialized objects need to be read from the database, so there is no >> session when the read actually occurs, and the exception is thrown. It >> seems like any complex Struts / Hibernate system would eventually run into >> this issue, as I have. I could specify everything as "EAGER", but that >> would (eventually) load my entire database and that's far from an optimal >> solution. >> >> As suggestions for fixing this, I have found references to the >> FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both claim >> that no code changes are required, and all that's needed are some >> configuration changes. The documentation on how to use these two solutions >> is sparse, at best. >> Has anyone used either of these two solutions? Is there any documentation >> floating around that I haven't found yet? Or is there another, better >> solution that someone has found? >> I know this is a Hibernate issue and not a Struts issue, but I think >> people here must have experience with this issue. >> >> Thanks in advance, >> Dennis >> >> >> >> > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Re: Struts2 / Hibernate Question
I use the FullHibernatePlugin in some small Projects, this is working very well for me. In larger Projects today I prefer Hibernate in combination with Spring Framework. Best Regards Johannes Geppert -- http://www.jgeppert.com http://twitter.com/jogep Dennis Atkinson wrote: > > Hello all. > > I am running into the infamous "closed session" issue, whereby I get a > LazyInitializationException on a lazy-initialized foreign key > relationship. The issue, as I understand it, is that the session is > closed before the lazy-initialized objects need to be read from the > database, so there is no session when the read actually occurs, and the > exception is thrown. It seems like any complex Struts / Hibernate system > would eventually run into this issue, as I have. I could specify > everything as "EAGER", but that would (eventually) load my entire database > and that's far from an optimal solution. > > As suggestions for fixing this, I have found references to the > FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both > claim that no code changes are required, and all that's needed are some > configuration changes. The documentation on how to use these two > solutions is sparse, at best. > > Has anyone used either of these two solutions? Is there any documentation > floating around that I haven't found yet? Or is there another, better > solution that someone has found? > > I know this is a Hibernate issue and not a Struts issue, but I think > people here must have experience with this issue. > > Thanks in advance, > Dennis > > > > - --- web: http://www.jgeppert.com twitter: http://twitter.com/jogep -- View this message in context: http://www.nabble.com/Struts2---Hibernate-Question-tp26031118p26031379.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 / Hibernate Question
Hi, Obviously there is a gap between Hibernate and Web-Application. OpenSessionInViewFilter working well, almost. I am using this filter and in the most cases it is enough. Sometimes I have to load Collection with size(). The another solution is to store only keys in the session and load the objects for every request from the Database/second level cash. The Eager Initialization does not work for two or more Lists in the class :( Regards Eduard Dennis Atkinson schrieb: Hello all. I am running into the infamous "closed session" issue, whereby I get a LazyInitializationException on a lazy-initialized foreign key relationship. The issue, as I understand it, is that the session is closed before the lazy-initialized objects need to be read from the database, so there is no session when the read actually occurs, and the exception is thrown. It seems like any complex Struts / Hibernate system would eventually run into this issue, as I have. I could specify everything as "EAGER", but that would (eventually) load my entire database and that's far from an optimal solution. As suggestions for fixing this, I have found references to the FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both claim that no code changes are required, and all that's needed are some configuration changes. The documentation on how to use these two solutions is sparse, at best. Has anyone used either of these two solutions? Is there any documentation floating around that I haven't found yet? Or is there another, better solution that someone has found? I know this is a Hibernate issue and not a Struts issue, but I think people here must have experience with this issue. Thanks in advance, Dennis - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts2 / Hibernate Question
Hello all. I am running into the infamous "closed session" issue, whereby I get a LazyInitializationException on a lazy-initialized foreign key relationship. The issue, as I understand it, is that the session is closed before the lazy-initialized objects need to be read from the database, so there is no session when the read actually occurs, and the exception is thrown. It seems like any complex Struts / Hibernate system would eventually run into this issue, as I have. I could specify everything as "EAGER", but that would (eventually) load my entire database and that's far from an optimal solution. As suggestions for fixing this, I have found references to the FullHibernatePlugin, and also the OpenSessionInViewFilter class. Both claim that no code changes are required, and all that's needed are some configuration changes. The documentation on how to use these two solutions is sparse, at best. Has anyone used either of these two solutions? Is there any documentation floating around that I haven't found yet? Or is there another, better solution that someone has found? I know this is a Hibernate issue and not a Struts issue, but I think people here must have experience with this issue. Thanks in advance, Dennis
Re: Any good Open source project using Struts2 + Hibernate+Spring I can learn from ?
Appfuse 2 (http://appfuse.org) 2009/10/2 Antonio Petrelli > 2009/10/2 BlackKnight : > > Are there any good open sourced project using SSH? > > Well, in fact I mean something else for SSH, anyway the Roller > weblogger uses it: > http://roller.apache.org/ > > Antonio > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Re: Any good Open source project using Struts2 + Hibernate+Spring I can learn from ?
2009/10/2 BlackKnight : > Are there any good open sourced project using SSH? Well, in fact I mean something else for SSH, anyway the Roller weblogger uses it: http://roller.apache.org/ Antonio - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Any good Open source project using Struts2 + Hibernate+Spring I can learn from ?
Hi,Folks, I've been using SSH for a while and are hoping to learn from some open source code if there are any. As for .net there are petshop. and Ejb there are petstore. Are there any good open sourced project using SSH? Thanks! Frank - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts2/Hibernate/Sitemesh
I am looking to use the following tools for our web application: - Struts 2.1.6 - Hibernate 3 - Sitemesh In our WEB.XML file I have added the following lines to support Struts2 with Sitemesh. struts2-cleanup org.apache.struts2.dispatcher.ActionContextCleanUp sitemesh com.opensymphony.module.sitemesh.filter.PageFilter struts2-prepare org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilte r struts2-execute org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilte r struts2-cleanup /* sitemesh /* struts2-prepare /* struts2-execute /* In my Struts1 application, we simply added another filter to the web.xml file that was called HibernateSessionInitFilter which extended the standard javax.servlet.Filter class. But what I see is suppose to happen in Struts2 is that I am suppose to subclass the struts2 class to add the hibernate framework. Should the StrutsPrepareFilter be subclassed or the StrutsExecuteFilter? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org