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
 Assigned to: 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.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://thecla.homeftp.net:8380/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
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