Francesco:
Answers below...
Francesco Marchioni wrote:
>
> Hello,
> I'd like to hear other people's opinion about 2 topics:
>
> 1) Is it a bad idea to put plain SQL queries in Session Beans ?
No, actually I think this is a great idea. Loading individual entity beans
for each and every row in a lookup might appear to be the correct way, but
it is also the slowest way. In your case, since this data is reference data
only and won't change, loading the data with a single SQL call is the
fastest way to do it.
>
> 2) Do I need to throw an EJB Exception in a method like
> this? or it's enough to handle an SQL Exception ?
> If I'm not mistaken throwing an EJBException will kill the transaction....
> while handling an SQL Exception would just exit the method
> gracefully...
I would attempt to handle the SQLException gracefully first, and if that
doesn't work throw an EJBException to indicate that you could not resolve
the problem. So, if the SQLException is something like a deadlock, you
should be able to recover. Otherwise, use EJBException to show the error
was fatal.
>
> Thanks for your kind attention.
> Francesco
>
Jonathan Baker
Internet Applications Division
Sybase, Inc.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".