Hi Bill,

Not related to your Hibernate queries - but I'd also recommend you evaluate
(if you've not already done so, of course!) iBATIS. The homepage is at:

        http://www.ibatis.com/

... and Rick has written an excellent worked example on getting iBATIS
working with Struts that really takes away any initial pain of integrating
it and providing a simple, lightweight but extensible interface into iBATIS.

        http://www.reumann.net/

The only reason I mention this - is not to try and provoke you into more
desk pounding - but after my brief evaluation of the two technologies - I
preferred iBATIS (by long shot). I have also been watching various
discussions recently and I notice several people moving from Hibernate ->
iBATIS but I've not seen any discussions on moving the other way. I thought
I'd pass this on in case you had not had opportunity or had not considered
iBATIS.

Hue.

> -----Original Message-----
> From: Bill Chmura [mailto:[EMAIL PROTECTED]
> Sent: 27 August 2003 07:20
> To: 'Struts Users Mailing List'
> Subject: HibernatePlugIn for struts (a few questions)
>
>
>
> Okay, I managed after much beating and desk pounding got hibernate to
> work in struts.  It just took some patience.
>
> Anyway, I now have two questions:
>
> #1 - Regarding the plugin that stuffs a hibernate sessionFactory into
> the servletContext.
>
> In my code I can use hibernate two ways:
>
> SessionFactory sessionFactory = (SessionFactory)
> getServlet().getServletContext().getAttribute(SessionFactory.class.getNa
> me());
>
> or
>
> SessionFactory sessionFactory = new
> Configuration().configure().buildSessionFactory();
>
> The first is using the plugIn.  Is the difference basically that the
> plug in will close it when the app closes, and there is no repeated cost
> if creating the session factory (as I believe it would only be done
> once)?  The second would be created every time the action was invoked
> thus incuring mucho overhead yes?
>
> #2 - Best practices.  I want to separate out the business logic into
> their own objects which I would then create and call different function
> on which would return data.  To do this they need to have access to
> hibernate.  What is the best way to pass down to these objects the
> connection to hibernate?  Should I just pass a servletContext, or
> actually a SessionFactory reference.  I am betting on the later as it
> would give a greater seperation from the app.
>
> For example I may have an object called CorporateInfo.  Methods would be
> stuff like getEvilDepartments(), getUselessDepartments(),
> getAllDepartments().  They would return lists of beans retrieved from
> hibernate.  My action could then use them.  I would probably put any
> modification code down at that level (like
> fireAllEmployeesInDepartment(department) ).
>
> Feedback?
>
> Okay, I am going to stand up now for the first time in like 5 hours -
> probably followed by passing out...
>
> Danka
>
> Bill
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to