I think you are both missing the point on this one.
Stored procedures are simply an alternate construct
for communicating with the database, and for the
purposes of entity beans, they isomorphic to dynamic
or embedded SQL. WHat difference does it make where
the actual SQL is executed ? That is really the only
difference in the execution of dynamic/embedded sql
vs. stored procedures.

As far as data encapsulation goes, I believe that you
can achieve much better encapsulation using stored
procedures. You can basically control how the data is
accessed in a very fine grained way, and some of the
strucures in PL/SQL are quite good at encapsultaing
access methods and data. Moreover, you are equally
exposed to data being updated from a source outside
the entity bean when using dynamic/embedded sql as you
are stored procedures. I do not see how you are
disadvantaged at all, except that CMP containers tend
to not support stored procs.

Ultimately, your entity bean must have a way to CRUD
records in one or more tables and be able to maintain
transactional consistency. It is equally well done
either way.

//Nicholas

--- Karthikeyan M <[EMAIL PROTECTED]> wrote:
> The point I was raising is that you would violate
> the data encapsulation that
> the Entity Beans provide, if you use stored procs to
> access the same data
> (assuming this stored proc is used by some other
> EJB). This will not make any
> difference if the stored procs perform read-only
> operations or doesn't access
> data maintained by other EBs. But, if they change
> the data that an entity bean
> is supposed to provide access to, then you might be
> in trouble.
>
> -karthik.
>
> Ted Neward wrote:
>
> > How is this any different from normal entity
> beans? The only difference
> > between a normal EB and one using a stored proc is
> that the stored proc will
> > be faster about retrieving its data.
> >
> > Ted Neward
> > {.NET || Java} Course Author & Instructor,
> DevelopMentor
> > (http://www.develop.com)
> > http://www.javageeks.com/tneward
> >
> > ----- Original Message -----
> > From: "Karthikeyan M" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, January 31, 2002 9:26 AM
> > Subject: Re: [EJB-INT] EJB and Stored-Procedures
> >
> > > Also,
> > >
> > > Shouldn't the decision on how the entities
> handle the data be made
> > carefully
> > > when stored procs are involved. Stored procedure
> is more like a
> > background
> > > access to data that an entity bean is supposed
> to provide uniform access.
> > If a
> > > stored procedure alters the data of another
> entity bean, what will happen
> > the
> > > next time someone invokes business methods on
> the other entity bean? This
> > is
> > > more so when optimizations are involved in how
> the ejbLoad() and
> > ejbStore() are
> > > executed.
> > >
> > > -karthik.
> > >
> > > Dmitri Colebatch wrote:
> > >
> > > > afaik none of the CMP engines around will elt
> you map to stored
> > procedures,
> > > > but I cant see any reason why a BMP entity
> bean couldn't use them.  I'm
> > > > assuming that the stored procedures will
> achieve the same functionality
> > as
> > > > insert/update etc.
> > > >
> > > > the only thing I can think of is that you
> might find you are forced into
> > > > using very coarse entity beans because of the
> stored procedure setup
> > (I"m
> > > > assuming they prevent you from breaking any
> foreign key constraints
> > etc.).
> > > >
> > > > my 2c
> > > >
> > > > cheers
> > > > dim
> > > >
> > > > ----- Original Message -----
> > > > From: "Benoit Aumars"
> <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Friday, February 01, 2002 12:34 AM
> > > > Subject: EJB and Stored-Procedures
> > > >
> > > > > Hi,
> > > > > I hope someone might give me some comments
> about how a
> > > > > stored-procedure can be used with an entity
> bean.
> > > > >
> > > > > I have an application which use a database
> with the following rules :
> > > > >    1. no users have an INSERT, UPDATE, or
> DELETE access into the
> > database.
> > > > >    2. put every SQL statement, i.e. INSERT,
> UPDATE, DELETE, or SELECT,
> > > > into
> > > > > a
> > > > >       stored-procedure.
> > > > >    3. all stored-procedures are owned by
> DBO.
> > > > >    4. users are only allowed to execute a
> SELECT statement or
> > > > >       run/execute a stored-procedure.
> > > > >
> > > > > Here are my questions :
> > > > >    a. how to use a stored-procedure with an
> entity bean ?
> > > > >    b. the database contains about 125
> tables, with about 10 tables
> > > > contains
> > > > > more
> > > > >       than 10.000 records. How this can be
> 'mapped' ?
> > > > >
> > > > >
> > > > > Thanks,
> > > > > Benoit Aumars.
> > > > >
> > > > >
> > > >
> >
>
===========================================================================
> > > > > 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".
> > > > >
> > > >
> > > >
> >
>
===========================================================================
> > > > 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".
> > >
> > >
> >
>
===========================================================================
> > > 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".
> > >
> > >
>
>
===========================================================================
> 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".
>


=====
Nicholas Whitehead
Home: (973) 377 9335
Cell: (201) 615 2716
Work(@ JP Morgan): (212) 235 5783
[EMAIL PROTECTED]

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

===========================================================================
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".

Reply via email to