It might depend on your vendor. If you are using Weblogic with the
read-only entity bean caching approach, have the entity contain a collection
and have your session bean retrieve its state from this collection. This way
you don't need to create entities for every session. For other vendors there
are patterns like Seppuku, I know there are several threads on Serverside,
one is
http://www.theserverside.com/patterns/thread.jsp?thread_id=10610


>From: Joel Riedesel <[EMAIL PROTECTED]>
>Reply-To: Joel Riedesel <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: How to have generic business logic in session bean?
>Date: Sat, 19 Jan 2002 07:28:38 -0700
>
>I don't think you did completely understand what I was asking
>for (not that I was entirely clear).  But you do raise further
>points.
>
>Suppose I have a SLSB: If Balance too High then Set Flag (or some such).
>
>If there are 10,000 concurrent sessions, then there'd be 10,000 of
>these, right?
>
>Now, the entities are things like account balance EB, etc.
>So, the session bean looks up the entity bean, gets the values, decides
>what to do, etc.  Pretty straightforward.
>
>
>But, I want my SLSB to be generic.  I want to somehow 'load' the
>logic that it uses to process the request.  Is that logic that it
>'loads' from an EB or from somewhere else?  If from an EB, then
>with 10,000 concurrent sessions, doesn't that require 10,000 instances
>of the EB and thus 10,000 loads from the database into those EBs?
>
>(Of course, once there is a 'good' number of EBs cached in the
>server, and if they are non-transactional - how does one make
>an EB non-transactional? - then no more loads need to be done,
>essentially.)
>
>Even still, suppose this 'logic' EB is large - say, 1 Megabyte in
>size.  10,000 of them would be kinda, uh, large.  It'd sure be
>nice for that EB to be sharable among all the 10,000 concurrent
>sessions via the generic SLSB.  Is there some way to make that happen?
>
>
>Does that further clarify my question?
>
>Thanks,
>Joel
>
>
>----- Original Message -----
>From: "Johan Eltes" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Saturday, January 19, 2002 7:05 AM
>Subject: Re: How to have generic business logic in session bean?
>
>
> > I'm not sure that I have understood your requirements. My interpretation
>of
> > your scenario is:
> >
> > 1) The method exceuteBusinessRule(String nameOfRule) is invoked by a
>client
> > on BusinessRuleService (SLSB)
> > 2) The SLSB calls findByPrimaryKey(nameOfRule) on BusinessRuleHome (EB)
> > 3) One of two alternatives:
> > a. The SLSB calls getRule() on the EB, which returns some kind of rule
> > representation. The SLSB then uses some rule-engine/parser utility to
>fire
> > the rule.
> > b. or...The SLSB calls the fireRule() method on the EB
> >
> > With SLSBs, you will never have 10000 instances in your app server. The
>App
> > server/EJB Container will only have one instance per concurrent thread
> > servicing a client request. I assume that one must expect that most
>"fired
> > rules" update the database. If you go for scenario 3a, you should be
>able
>to
> > declare the EB as none-transactional. That would let the container
>optimise
> > the usage of cached instances (no un-necessary load/store). With
>scenario
> > 3b, you would need a transactional EB ( to propagate the transation
>context,
> > which you need to get ev. resource managers used by the rule associated
>with
> > the container transaction). The container would then be forced to
>store/load
> > the entity bean instance for every request.
> >
> > /Johan
> >
> > -----Original Message-----
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Joel Riedesel
> > Sent: den 19 januari 2002 01:06
> > To: [EMAIL PROTECTED]
> > Subject: How to have generic business logic in session bean?
> >
> > Ok, new topic (I hope!).
> >
> > Now that I'm starting to understand how to use EJBs I'm having
> > some difficulty coming up with the proper architecture.
> >
> >
> > I've got a general business-logic representation.
> > One 'authors' their business logic (who cares how) and
> > then makes it available so that thousands of users
> > can 'use' the business logic.
> >
> > I want to map that to the app server, ejb world (why not, everyone
> > else seems to be doing it!).
> >
> >
> > The 'user session' data obviously equates to a bunch of entity
> > beans.
> >
> > But the business logic ought to be a session bean.  Except
> > that it is a generic session bean that somehow needs its
> > 'logic' loaded in in order to 'enact' the what the
> > authored logic does.  (Think of it as a scripting language
> > where the evaluator is in the session bean, but the stuff
> > that is being evaluated is loaded in dynamically.)
> >
> >
> > Now, if I have 10,000 users hitting the app server, that's 10,000
> > session bean instances.  They are all using the same 'business logic'.
> > (But these 10,000 uses all have their own data, so the entity beans
> > all do the right thing with scalability, etc.)
> >
> > How the heck can the loading of the session bean be done efficiently?
> > (That's my question.)
> >
> > Because I want to think of this as application-logic, business-logic,
> > there is only one application (so to speak), but many users.
> > (Modelling the application/business logic as an entity bean means that
> > it is read 10,000 times even though it is not changing.)
> >
> > Or is there a better way to think about this?
> >
> > Joel
> >
> >


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.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