Real app business logic, access serialization

Hi,
in our real application we have some business logic.
The bc4j examples show for example how to limit the value
of a colum between two values.
But our business logic is not limited to a so
simple case.
For us is very common that business logic involves
more (aggregate) tables.
For example consider a invoice and
the line of the invoice. These are two tables but
a business rule say that the sum of the line should
be the total column of the invoice. Moreover the
total of the invoice can't be zero. The need the
existence of the total column in invoice is required
because speed up queries and for the constraints and
we can't make it only a display value of a
query.
To avoid data corruption we have noted that access
should serialized for a invoice. Otherwise two user
can change the lines and the total can be correct in the
session but may not be correct at the end of the
two commit.
How can we obtain this in bc4j? Where should we place
the code? How to make access of the invoice serialized?
There is some documentation or code example of this?
Very thanks in advance!

By marking the lines entity to be composed with the invoice entity, and marking the "lock top-level entity" you can automatically achieve the serialization you're looking for using BC4J.
If anything in the invoice, or any composed children are modified, it will lock the top-level parent (invoice) before allowing the edit to proceed.
To express a rule that asserts a rule about the sum of the detail lines, write a entity-level validation rule in the invoice (parent) entity which uses the association accessor to iterate the lines and calculate the sum.

Similar Messages

  • Accessing LCDS Persistence Layer for use in Server-Side Business Logic

    Within server-side business logic, I want to be able to get a persisted object from LCDS, manipulate  that object, and then use LCDS to persist those changes to the database  as well as send those changes to the client.
    Is it possible to access LCDS' persistence layer (Hibernate) to be used by server-side business logic?
    I have attempted to use DataServiceTransaction.getItem(...).  However, for objects that contain a collection of other objects I get this error:
    [LCDS] Runtime exception while trying to fetch a property from hibernate: flex.data.DataServiceException: There is no current message broker to return.
    When calling DataServiceTransaction.updateItem(...) for objects that contain a collection of other objects, I get this error:
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.sd.pojo.Book.chapters, no session or session was closed
    Also, it appears that DataServiceTransaction.updateItem does NOT update the database?
    I have resorted to building my own Hibernate SessionFactory, but that seems unnecessary.
    One other piece of information is that I am using the Fiber modeling tool to build and deploy the model to the server.  I am generating the Java classes with Fiber and making them available to be used on the server.
    Thanks,
    Collin

    Thanks for the help guys.
    I guess what I'm really trying to get straight in my own mind is whether supporting interraction and control of eJB database interraction is still using the same functionality as having a stand alone app interracting with a db.
    I'm thinking about; the implications of using eJBs specific query language and the different way in which eJBs use db connections (either for the period of their lifetime or just for the duration of one interaction) compared with a stand alone app, which would maintain a connection to the database(s) while it is open.
    Connection pooling and caching of DB objects is often quoted as being a middle tier activity, but what does this mean when all 3 tiers reside on the same machine?
    Once again thanks for your comments and advice.
    Mark

  • Urgent: how to really seperate business logic class from data access class

    Hello,
    I've this problem here on my hand and i really need help urgently. so please allow me to thank anyone who replies to this thread =)
    Before i go any futhur, let me present a scenario. this will help make my question clearer.
    "A user choose to view his account information"
    here, i've attempted to do the following. i've tried to seperate my application into 3 layers, the GUI layer, the business logic layer, and the data access layer.
    classically, the GUI layer only knows which object it should invoke, for example in the case above, the GUI would instantiate an Account object and prob the displayAcctInfo method of the Account object.
    here is how my Account class looks like:
    public class Account
    private acctNo;
    private userid;
    private password;
    private Customer acctOwner;
    the way this class is being modelled is that there is a handle to a customer object.
    that being the case, when i want to retrieve back account information, how do i go about retrieveing the information on the customer? should my data access class have knowledge on how the customer is being programmed? ie setName, getName, setAge, getAge all these methods etc? if not, how do i restore the state of the Customer object nested inside?
    is there a better way to archieve the solution to my problem above? i would appriciate it for any help rendered =)
    Yours sincerely,
    Javier

    public class AccountThat looks like a business layer object to me.
    In a large application the GUI probably shouldn't ever touch business objects. It makes requests to the business layer for specific information. For example you might have a class called CustomerAccountSummary - the data for that might come entirely from the Account object or it might come from Account and Customer.
    When the GUI requests information it receives it as a 'primitive' - which is a class that has no behaviour (methods), just data. This keeps the interface between the GUI and business layer simple and makes it easier to maintain.
    When using a primitive there are four operations: query, create, update and delete.
    For a query the gui sets only the attributes in the primitive that will be specifically queried for (or a specialized primitive can be created for this.) The result of a query is either a single primitive or a collection of primitives. Each primitive will have all the attributes defined.
    For a create all of the attributes are set. The gui calls a method and passes the primtive.
    For an update, usually all fields are defined although this can vary. The gui calls a method and passes the primitive.
    For a delete, only the 'key' fields are set (more can be but they are not used.) The gui calls a method and passes the primitive.
    Also keep in mind that a clean seperation is always an idealization. For example verify that duplicate records are not created is a business logic requirement (the database doesn't care.) However, it is much easier and more efficient to handle that rule in the database rather than in the business layer.

  • Bean containing both UI components and business logic

    Hello  ADF design experts,  please guide me.   I came across a critical design aspects.  I have main page having bunch of UI components,   Region 1,  Region 2. I will have to bind the UI components of the page to a managed bean having session scope and the reason is,  when control goes to region 1 or region 2, I will be doing lot of  processing of business logic  and then based on this,  I will have to update the UI components of the page.   Same thing with region 2 also.  And then,  I should be able to access the information    across regions and also across other UI components etc.
    I am seeing only  session scoped bean will be able to help me here to get my tasks done across regions and across all other UI components of the page because I am not in a position to pass too many parameters across regions.     Now the problem is,  I can not serialize this bean  because as I mentioned  lot of UI components are updated based on logic. 
    If I do not serialize the bean, I may have problem in future when application has to be deployed to cluster envt.
    I do not know how should I go with my design now.   Please provide me brilliant ideas and very thankful to your guidance.
    thanks

    Hi ADF,
    I dont want to disturb the discussion with you and Alej. I'm rising some question from your first post.
    I have main page having bunch of UI components, 
    ok fine.
    Region 1,  Region 2. I will have to bind the UI components of the page to a managed bean having session scope
    1.why need to do this binding for all ui components .?
    2.this question lead ask another question are you using ADFBc.? if so binding layer will take care why you bind all those things.
    3.why you need to put session scope.?
    if you are using region. the region can only be bounded TF right, then communicate with help of pageflow. inside the bounded you may have jsff/jspx,
    reason is,  when control goes to region 1 or region 2, I will be doing lot of  processing of business logic  and then based on this,  I will have to update the UI components of the page.   Same thing with region 2 also.
    from the reason i have question? why you need to communicate between two region instead of using Taskflow communication.
    And then,  I should be able to access the information  across regions and also across other UI components etc.
    ok fine.
    I am seeing only  session scoped bean will be able to help me here to get my tasks done across regions and across all other UI components of the page because I am not in a position to pass too many parameters across regions.     Now the problem is,  I can not serialize this bean  because as I mentioned  lot of UI components are updated based on logic. 
    from my point of view. your are using all powerful feature session bean, region communication to do your requirement.
    mixing all those things so only you can't able to get consistent results.
    I do not know how should I go with my design now.
    could you please explain your usecase.
    Please provide me brilliant ideas and very thankful to your guidance.
    yeah sure. people will do.
    thanks

  • Best way to structure Business Logic

    Hi Experts,
    I am using Web Dynpro for my front-end and application services for the back-end. Which of these is the recommended way to structure the layout of my business logic:
    1) Keep everything in the 'src' folder of the CAF ejbmodule. Structure through the use of packages.
    2) Create an external Java DC, keep all code in there and call the code from the application services. Structure code through both packages and the use of multiple DCs.
    3) Create a child Java DC in the CAF ejbmodule project, keep the code there. Structure code through both packages and the use of multiple DCs.
    4) Some other way which I do not know of???
    I think that (2) is the best way to to this, but I'm not sure and I also don't know how to make the code in the Java DC accessible from the CAF in 7.1. In 7.0 one was required to assemble the Java DC into a J2EE Server Library project and then create the required dependencies. How does this work in 7.1?
    Thanks,
    JP

    Hi JP,
    > When you refer to "regular reference stuff" I take it
    > you mean the application/library references in your
    > 'application-j2ee-engine.xml' file?
    Correct.
    > Is there an easy way to discover which
    > application/library to reference, for example, if I
    > wanted to make use of 'com.sap.security.api.IUser'?
    >
    > It was always very difficult to find the correct DC
    > containing the required classes in 7.0 (usually one
    > had to use a JAR class finder). Is there an easier
    > way in 7.1?
    Hmm, I guess it would be a rather tough task to have a mapping between all classes (or even packages) and DCs. However it should be fairly intuitive to infer the DC from the class / package name. If still in doubt, you can search for its usage on help.sap.com - most probably you'll find the DC name as well therein.
    > Finally, how about Web Dynpro classes (like
    > com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser
    > ): I'm not sure if it will ever be necessary, but can
    > they be accessed from Java DCs?
    According to the <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/javadocs">NW public javadocs</a>, the classes in the com.sap.tc.webdynpro.* packages are "Services in the Web Dynpro runtime environment that can be called by custom coding in Web Dynpro applications", so they're not intended for general use in any type of app.
    HTH!
    -- Vladimir

  • Where to implement my Business Logic in ADF?

    Hi,
    I am new to Oracle ADF. I found this forum very useful to get my queries and doubts answered. Thanks to the participants.
    I am basically from Struts background,
    Where i design my UI in jsp pages using Struts tags,
    Actions and some utility classes handles my most of the business logic (generally called as Business Layer)
    Then i have custom DAOs or Data Layer to query or update the data in database.
    Now as I am into new Project and I have to learn Oracle ADF.
    I started learning this by following some questions in the forums and various sites (from Google).
    I got info on How to create Entity Objects, Value objects etc.
    But my major doubt is where shall i write my Business Logic in this stack?
    I can easily drag and drop my data controls into my JSF page and create table, forms or charts. But if i have a multi line business logic, say for a Submit button, In which i may be doing the following steps -
    a.  Get data pertaining to user role , department, his tenure in the department etc
    b. On submit do processing based on data collected in above step.
    c. update data in data base.
    d. initiate an approval process
    e. call some business process for Approval
    f. Audit Trail
    g. Transaction handling
    and so many other steps (I know most of you will have gone through these situation before starting work on ADF)
    Now, in the above scenario in Oracle ADF layers where shall i write this whole bunch of logic or steps and then forward the user the page depending upon the outcome of this logic.
    Please let me know where to write all this??
    Thanks a lot,
    Amit
    Edited by: ur.amit on May 13, 2010 4:58 PM

    Generally speaking all of that code would reside in the app module Impl classes or the View object Impl classes - for VOs and AMs you can expose subclasses and add code in there - you can then define whether any of your methods should be exposed to the client, in which case they appear in the Data Controls panel as operations.
    General word of advice -keep business logic code in the Model - don't be tempted to start trying to access your AMs and do any of this stuff from the ViewController project. Keep it nice and simple and just access ALL the business logic code through ADF Model.
    Hope this helps
    Grant

  • Where do I write business Logic?

    Hi,
    Where do I write bisiness Logic?
    Tutorial said "It is common practice to include the bean property and the Action
    implementation to which it refers within the same bean class".
    But I thought EventHander Impl is better to write business Logic
    like retrieving the data from database.
    Which is common use?
    Or I need to choose them depending on the situation?
    Thanks in advance for you help.
    tomo

    Thanks for the reply!!
    But I am still confused.
    I thought I can write business logic A and B.
    What is difference between A and B ??
    Hi tomo,
    In the two options you provide the difference is not that much. The ActionListener instance willhave to be registered in your JSP of course to listen to the button or hyperlink with the f:action_listner tag. But in both cases your biz logic is in your ui. I think that is the wrong direction for you to head.
    I think the real question should be (forgive me if I'm pulling the discussion away from your question, but I think this is relevant) where does the business logic go.
    As Kito said your biz logic belongs apart from your UI logic (classic MVC approach). So in the real world what does that mean? As you suggest in option B in your last post a bean provides an action so that it can be specified via the actionRef attribute. This action in turn invokes a method on the bean it comes from which then invokes the business logic on the 'real' business logic.
    The Action becomes simply a translator (or part of the Adaptor pattern from the GoF book).
    For example lets say you have a bean that does biz processing like this;
    public interface CatalogFacade {
      public Collection getProducts(ProductSearchCriteria criteria);
    }And you want to invoke that 'business logic' from your JSF UI. The button would be declared with this code
    <h:comman_button id="searchCommand" type="submit"
                        label="Search"
                        commandName="search"
                        actionRef="searchBean.searchAction"/>In your searchBean you have many options to return the searchAction but I prefer the following
    public class SearchBean {
       public SearchFacade searchFacade = null; // this could be a managed bean or an EJBSession or whatnot
       public ProductSearchCriteria productSearchCriteria = null; // this should be 'filled' in by the form the button is on
       private transient Action searchAction = new Action() {
        public String invoke() {
          return search();
      public Action getSearchAction() {
        return searchAction;
      public void search() {
        Collection products = searchFacade.search(productSearchCriteria);
        // place the products collection into the next page's bean so that is can be found via valueRef attributes
    }Notice that no database hits are happening in the UI code. Also there is no business logic here either.
    It is very important to keep these two concerns divided for ease of maintenance. The typical reasoning goes something like this, 'your ui is very likely to change so keep it separate from your business logic'. Other reasons to be careful about mixing UI and biz logic is the likely hood that you will get very different behavior (one probably wrong) if you have to and another client to your biz logic.
    For example in the earlier product search stuff. If we needed a web service front end to the 'searchProducts' functionality and we had the db hit happening in the action or page bean we would be stuck. With the above impl we get to just put a WS over the facade and we are done.
    Hope this helps.
    You can also look at some of the blueprint patterns for more info. They start here;
    http://java.sun.com/blueprints/patterns/index.html
    While some of the EJB specific patterns might be more involved than you need they provide excelent archtectural guidence for web only apps as well.
    Good luck,
    -bd-

  • Future support for using PL/SQL core business logic with ADF BC

    We want to migrate our large Forms client/server (6i) application to ADF, possibly using a migration tool like Ciphersoft Exodus.
    One scenario could be to use ADF BC and ADF-Faces or a different JSF-Implementation for presentation and business layer but keep our heavy PL/SQL-businesslogic inside the Oracle database in packages, triggers, functions and procedures.
    This scenario could be chosen due to the huge amount of interconnected logic inside the database (10 years of development; no technical components; any package may access any table and more of this kind of dependencies). The business logic nowadays held in Forms client will be moved mainly into the database as a prerequisite to this scenario.
    Choosing this "keep-logic-in-DB"-scenario we need a good support by ADF BC to do so. We know and prototyped that it is possible to call some PL/SQL via JDBC from ADF BC and it is possible to use stored procedure calls for standard business entity data access (ins, del, upd, ..). But this does not solve our problems. We want to reuse core business logic coded in PL/SQL. This is much more than change the ADF standard behavior for an update with an own PL/SQL-call.
    Now my question:
    Will there be a kind of sophisticated support to use ADF BC in combination with database-kept logic?
    If so, when will this happen and how will the common problems of transactional state inside the database and inside the ADF BC be solved? Any plans or ideas yet?
    Many other clients do have similar applications built in Forms and PL/SQL and would be glad to hear about a path of direction.
    I've read the technical article 'understanding the ADF BC state management feature' which you have contributed to. One current limitation is pointed out there: Using PL/SQL with ADF BC limits ADF AM pooling to 'restricted level' which reduces scalability.
    Are you aware of additional main problems/tasks to solve when using PL/SQL heavily with ADF BC, which we have to think about?
    Thank you for any response.
    Ingmar

    My main problem is two 'concurrent' areas holding state in an application system based on DB-stored PL/SQL-logic in combination with ADF BC.
    For a new System everything can be made ok:
    Sure, it is possible to build a new system with the business logic included in ADF BC only. All long-living state will be handled in the BC layer ( including support for UnitsOfWork longer than the webside short HTTP-requests and HTTP-sessions and longer than the database transactions.
    For an old system these problems arise:
    1. DB data changes not reflected in BC layer:
    Our PL/SQL-logic changes data in tables without notifying the ADF BC layer (and its cache). To keep the data in ADF BC entity objects identical to the changed database content a synchronization is needed. BC does not know which part of the application data has been changed because it has not initiated the changes through its entity objects. Therefore a full refresh is needed. In a Forms4GL environment the behavior is similar: We do frequently requeries of all relevant (base)tables after calling database stored logic to be sure to get the changed data to display and to operate on it.
    -> Reengineering of the PL/SQL-logic to make the ADF BC layer aware of the changes is a big effort (notifying BC about any change)
    2. longer living database transactions
    Our PL/SQL-logic in some areas makes use of lengthy database transactions. The technical DB-transaction is similar to the UnitOfWork. If we call this existing logic from ADF BC, database state is produced which will not be DB-committed in the same cycle.
    This reduces scalability of ADF BC AM pooling.
    Example:
    a) Call a DB-stored logic to check if some business data is consistent and prepare some data for versioning. This starts a DB-transaction but does not commit it.
    b) Control is handed back to the user interface. Successful result of step a) is displayed
    c) User now executes the versioning operation
    d) Call another DB-stored logic to execute the versioning. DB-transaction is still open
    e) Business layer commits the transaction automatically after successful finishing step d). Otherwise everything from a) to e) is rolled back.
    -> redesign of this behavior (= cutting the 1to1 relation between LogicalUnitOfWork and the technicalDatabaseTransaction is a big effort due to the big amount of code.

  • Push messages from business logic into backing bean

    In my simple web application a table with the contents of a database table is shown to the client. Now I want this table in the browser to be updated each time the db table is updated. In my business logic a jms message is fired to a specified topic each time the db table is updated. The reverse ajax stuff needed for the client update is provided by the Icefaces jsf implementation. There is a backing bean for each session which is responsible for the server side rerendering of the client. Now my question is: How do I connect the bussiness logic firing a jms message if the db table is updated, with the backing bean?
    My thoughts:
    1. Create a message listener for the topic. Each time the message listener receives a message it notifies the backing beans of each session to rerender the client. But how does the message listener know about the backing beans?
    2. The backing bean responsible for rerendering the client adds itself as a listener. But where? As I understand it cannot be a backing bean and a jms MessageListener at the same time.
    Has anyone an idea/pattern for this problem?

    You could keep a list of beans that need to be notified in the application scope. (You should probably use weak references so that they may be garbage collected.) Then you JMS listener could get access to them.
    Somebody posted a thread recently where they were doing something very similar, you might want to try to find it.

  • The best way to implement business logic to a .JSP ?

    Hi experts,
    I want to implement some business logic to a .JSP file wich is in my modified
    <b>com.xxxNew.portal.usermanagement.admin.pa</b>r file!
    For examle creating different roles for useres by registration dependently what they inseret in the registration.jsp!
    What is the best way to do this? I have tried out to create a stateless session bean for this. Is this the right way?
    Can someone give me information how can I access this bean from my JSP (.par file) and how can I upload it to the portal?

    Hi,
    Here is the document about Calling J2EE Applications from Portal Applications:
    http://help.sap.com/saphelp_nw70/helpdata/en/42/9ddf20bb211d72e10000000a1553f6/frameset.htm
    So in your JSP do the lookup of your EJB.
    I do not think using EJB at this level is really good, as you do not deal with DB, security and transactions in your code.
    http://www.jguru.com/faq/view.jsp?EID=126400
    Why not just use a portal component like JSPDynpage for this purpose?
    Greetings,
    Praveen Gudapati

  • Business logic in EO, VO - design advice required

    Hi all,
    I'm looking for some design advice on the best way to approach this issue - or in fact advice that I'm making an issue out of something where it doens't need to be !
    Lets say I have a single entity object called UsersEO. I have two view objects called NewUserVO and ExistingUserVO. I use the NewUserVO just for inserting new records and the ExistingUserVO for modifying existing records. When users are editing existing users, I need to provide a checkbox that indicates that when the record is saved, their password needs to be re-generated and emailed out to the user.
    I want to include the check of the "GeneratePassword" attribute while processing the rest of my user business logic, in the doDML method of UsersEOImpl. From here I will call a database procedure that handles changing the password and emailing the user.
    Initially I created a transient attribute "GeneratePassword" in ExistingUserVO but then to access this from within the UsersEOImpl.doDML would require me getting the AM from the transaction, and getting the current row of the ExistingUserVO. I believe that this is bad practice to access a VO from within a EO ?
    Is my only option here to create the transient attribute "GeneratePassword" on the UsersEO and then include in the ExistingUserVO but not the NewUserVO ? That way I can easily access the "GeneratePassword" attribute from with the doDML without have to accessing the VO.
    If I have 10 different VO's that require different attributes, it just seems strange to add 10 attributes to the underlying EO and then only include the relevant entity attribute in each VO - or is this exactly what I should be doing ?
    On a slightly different note, but similar theme - if I had a "VOTransaction" attribute in my EO and I included this in each VO created from the EO - how would I set different values in this attribute for each VO so that within the EOImpl I would know which VO was triggering the entity validation ??
    Many thanks for your help !
    Cheers,
    Brent

    >
    If I have 10 different VO's that require different attributes, it just seems strange to add 10 attributes to the underlying EO and then only include the relevant entity attribute in each VO - or is this exactly what I should be doing ?
    How about creating a BaseVO which extends EO (including transient attributes for password change and voName/Type detail ) that provide a default value for voName/Type attribute and all other VO extending the BaseVO and overriding that attribute setter to specify the name/type?

  • Business Logic in BC4J. Guide please

    I have a question regarding BC4J
    I am currently reading the white paper on this :
    http://www.oracle.com/technology/products/jdev/info/techwp20/wp.html#introduction
    Find figure 8(View Objects Cooperate with Related Entity Objects...'
    and see the 2nd para, which has a statement :
    " For example,assume that an Employee Entity Object has a busined
    logic which raises the employee's salary when she is promoted "
    My Question:
    How can you build this business logic into the database? Isnt business logic supposed to be the integrity constraints,checks and default values for a table that are defined during the table creation?
    How can you build such a business logic?
    Perhaps we can build this thru' triggers.Am I right or can some one please
    clarify this point?

    Isnt business logic supposed to be the integrity constraints,checks and default values for a table that are defined during the table creation?As this looks very much like my definition of business logic I guess I'd better run with it.
    Business logic is the rules that control the use of data. So, "every employee must belong to a valid department" is a business rule, which we can implement through a foreign key constraint. There are other simple rules which we can implement using unique constraints, not null constraints, default values, etc.
    Because we tend to focus on database implementation we tend to forget that the structures in the database actually map to business requirements in the real world. Why is EMPNO the primary key of the EMP table? Because the business needs a simple way of uniquely identifying each employee, and name is rarely sufficient.
    The example you give is a more complicated business rule: when such-and-such an event occurs, do this thing. In this case you are right to suggest...
    Perhaps we can build this thru' triggers
    CREATE OR REPLACE TRIGGER emp_salgrade BEFORE UPDATE OF grade ON employees FOR EACH ROW
    DECLARE
        gsal NUMBER;
    BEGIN
        SELECT losal
        INTO gsal
        FROM salgrade
        WHERE  grade = :NEW.grade;
        IF gsal < :NEW.sal THEN
           :NEW.sal := gsal;
        END IF;
    END;Cheers, APC

  • Business Logic in Oracle Applications (General Question)

    Hello everyone!
    I am relatively new to Oracle Apps and interested in learning and joining this community.
    I was trying to figure out how is the Business Logic programmed in E-Business Suite. Is it just PL/SQL or is it BC4J? Is there anyone who could help me answer this question or point me in the right direction (I went through the documentation very quickly (it is rather large so it was only "briefly") and could not find anything that would answer my question exactly)
    By Business Logic I mean business-related tasks such as "enter a journal entry" or "issue sales order" (with a higher or lower level of granularity of course)
    Any help is much appreciated !

    Just to expand on Bala's answer, it depends on how your application is architected.
    If you have a Forms based application, then your Business Logic (BL) resides in PLSQL. The forms tier performs the basic validation and partial BL execution and passes the data to the handlers in the database to perform the DMLs and initiate required Business Process.
    If you have a OA Fwk based application, then your BL could reside either in BC4J or PLSQL. There are OA Fwk applications that are written that performs some business logic execution within the middle tier and passes the rest to underlying PLSQL code. Take for example an application that was originally written in Forms but later on extended or migrated to OA Fwk. Since most of the BL was already written in PLSQL and some of the forms would still be using the same PLSQL APIs, it essential that the OA Fwk based application too uses those APIs to be in synch.
    If you are designing a new application to be based on OA Fwk, it is strongly recommended that you go with your BL as much as on the middle tier.
    So it all depends... :)
    Thanks
    Vijay

  • Entity Beans and Session beans to represet Business lOgic

    How cam we implement Entity Beans and Session beans to represent Business Logic.
    Can anyone explain how can we do this.
    Regards...

    I have session beans calling method in entity beans and any client
    doesn't have access to entity beans, only via session beans.
    If i define security policy and method permissions for session beans
    only, do entity beans use that permissions when calling their methods
    from sessions beans OR should i define the security policy for entity
    beans separately?If you want to set the permission on individual
    methods of entity bean ( with different roles)
    you have to do it separately.
    If you want to delegate the Authenticated user along with
    the method call to the Entity Bean you can use
    run-as-identity-principal.
    For more detail please check out the EJB2.0 Spec.
    -utpal

  • Business logic in PL/SQL?

    Hello,
    I am designing a 3-tier, web-based intranet application for my client. It's going to be a WebSphere portal app with Struts, running on Oracle 8.1.7.
    One of the requirements is to implement the business logic in the back-end (PL/SQL), not in Java (although that is what I'm used to do). The reason probably has something to do with fear of performance issues ("the more code runs in Oracle, the faster") and resource planning ("more people here know Oracle better than Java").
    This unusual (?) choice in my humble opinion leaves me with two major issues; how to cache database results and how to perform the O/R mapping.
    I know how to use CallableStatements and JDBC, but I'd really like to avoid such a solution now we have EJB 2.1 and Hibernate and everything. And without caching as done by any sensible app server I fear performance issues.
    Does anyone know a tool that can perhaps generate Java code and performs the O/R mapping? Or a tool that avoids me having to implement up to a hundred (!) CallableStatements and ResultSet-To-JavaBean mappings. I've seen Apache's commons-dbutils that seems to do this.
    Does anyone have experience implementing business logic in PL/SQL and calling procedures from Java? Is performance really an issue here?
    Thanks in advance for any input,
    regards,
    Bram Rooijmans

    This unusual (?) choice in my humble opinion leaves me
    with two major issues; In non-trivial applications excluding all business logic from the database is usually an architecture or design bug. Businesses do use the database directly due to legacy, tools, comfort level, etc. And in those cases the data still needs to be consistent. Not to mention that for some business logic the database can be orders of magnitude faster in running it versus external logic.
    On the other hand I would consider it a bug as well if someone told me that all the business logic must be in the database and no where else. (At the very least I would suspect and question their definition of business logic in that case.)
    I know how to use CallableStatements and JDBC, but I'd really like to avoid such a solution now...How are you going to implement any non-trivial business logic in oracle without using stored procs?
    Does anyone have experience implementing business logic in PL/SQL and
    calling procedures from Java? Not sure of the question. Certainly I have implemented business logic in PL/SQL. And many people have used stored procs via java.
    Is performance really an issue here?No idea. That is a dependency of your system, not of java/databases in general.
    I have seen java only solutions that even with scalling take hours to do operations that could be done in much less time using the database itself.
    I have seen requirements which would have taken hours even in the database and changing the requirements meant it took less than 2 minutes. (It had nothing to do with java nor the database.)
    I have seen code implementations which took significant database processing time where the entire solution could have been done without the database at all.
    I have seen solutions where, due to business requirements, the same business logic was implemented in different languages and in slightly different ways in each. Implementing the logic in stored procs meant that all of the systems that used it now would be using the same rules. In that case it is possible that the solution was actually slower. But if it was it was not noticed and the consistency was much more important.

Maybe you are looking for