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