Yes, that is actually a better option.  The only challenge with it is that if 
the delegate method returns something, you must temporarily store it locally, 
do the session.flush(), and then return that something.  The return type is 
there anyhow, so it should be easy.  I just didn't try that fix.



On Thursday 03 March 2005 11:02 am, Chad Brandon (JIRA) wrote:
>      [
> http://thecla.homeftp.net:8380/jira/browse/HIB-62?page=comments#action_1105
>2 ]
>
> Chad Brandon commented on HIB-62:
> ---------------------------------
>
> Wouldn't it be better to just have the session.flush() within the try block
> then (since it shouldn't happen if an exception occurs)?
>
> > Problems with session bean template
> > -----------------------------------
> >
> >          Key: HIB-62
> >          URL: http://thecla.homeftp.net:8380/jira/browse/HIB-62
> >      Project: Hibernate Cartridge
> >         Type: Bug
> >     Versions: 3.0RC1
> >  Environment: Release from 21 Feb 2005
> >     Reporter: David Allen
> >     Assignee: Martin West
> >     Priority: Minor
> >
> >
> >
> > Unused import for InitialContext can be removed.
> > Use of sessionFactory static member in a non-static way
> > (this.sessionFactory) generates compiler warnings.  The static member
> > should be accessed as just sessionFactory, or
> > <class-name>.sessionFactory. Business method structure should not call
> > flush() on the Hibernate session if an exception has already occurred.  I
> > fixed this by using a boolean to indicate success (default true) where
> > each catch block sets it to false.  Then I test the boolean before
> > calling session.flush(). Another problem with the same block of code
> > generated is that the finally block also throws an exception.  This will
> > replace the real exception that might have been thrown already, and thus
> > cause loss of information.  I still have it there since I fixed the
> > session.flush() problem which always caused the real problem to be
> > masked, but it might be better to check the boolean before throwing a new
> > exception just due to flushing or closing the session.

-- 
David Allen
[EMAIL PROTECTED]


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel

Reply via email to