Ejb  design concern

I have more than 40 tables in backend,
The corresponding entity beans have been designed
Now I want to use one or several stateless session beans as facade to exposed API to clients
What business logic should I put in the session beans?
How many session beans I am suposed to employ?
So far we do not have more business logics needed except for basic database operations (insert, delete, update, select)
The one problem is confusing me is that I do not know exactly how clients(servlet, or web service) do data access
What I want to do is to abstract most client access again database into several methods. How can i do that?
Is it a good idea to develop four stateless beans for delete, update, insert and select, respectively?
Or simply design one stateless session bean to include all methods mentioned above?
Any suggestion
Many thanks!

I have more than 40 tables in backend,
The corresponding entity beans have been designed
Now I want to use one or several stateless session
beans as facade to exposed API to clients
What business logic should I put in the session
beans?Rather than starting with your 40 tables and pushing outwards towards you application, try taking your application design, thinking about what it wants to do, and then push inwards. While read/writing/updating data is a large portion of application design, the more important parts tend to be the data relationships and the data processing. Those are the portions that require all of the reading/writing/updating of the data. You don't read data for no reason.
For example, say you have a typical order entry distribution system. When you ship an order, you could easily have to a) update the actual order data, b) generate a shipping record, c) add to order history d) notify the customer via email.
While that may well access four different tables in the database, it's really only a single process, and may well be a single method: OrderSessionBean.shipOrder(Order o).
The OrderSessionBean could easily interface with the CustomerSessionBean.sendShippingNotification() routine, and the ShippingSessionBean.createShipment(...) routine.
But that's the rub, isn't it. Should OrderSessionBean create the shipping data (since it's based on the order), or should the ShippingSessionBean create the data. Basically that's a judgement call. On the one hand, you don't want a single session bean that's your entire applicaiton. That's just madness and very difficult to maintain. On the other, you don't want a session bean for every individual method in your system.
So you need to balance the two extremes and try to come up with a good balance. But you just remember, the data doesn't exist in a vacuum. Those tables are there for a reason. Let the application needs drive this, don't simply make interfaces for no purpose.

Similar Messages

  • Where can I get the material about EJB Design?

    I am working with EJB for a short time.I know that a
    well-designed architecture is very important.So I want to learn more about the EJB Design.Can anyone tell me where to find such material?And which book shall I choose?
    Thank you.

    if you are doing some browse-server design using ejb, I think you can read the sun's blueprint of j2ee, and study the sample application - pet store.
    best regards.

  • How can I develop a web application using EJB design pattern?

    I have searched over the web and found quite a lot of tutorials on how to use the EJB design pattern.
    I know that there will be a home interface, EJB object interface and a SessionBean.
    But the tutorials often only cover a single class, this made me unable to get a complete picture of how EJB design pattern can be implemented into a whole system.
    I am now required to devleop an online shopping web application using EJB and JSP page.
    I think I will need to create a lot of classes: Member, ShoppingCart, Product...etc.
    What I want to ask is that, do I need to create a home interface, EJB object interface and a SessionBean for each of these classes?
    I really need some ideas on how to develop this system using EJB + JSP pages.
    Many thanks to you all.

    For every EJB that you want to create, you will need to code a home and remote interface and a bean class.
    You could start getting your ideas here
    http://www.theserverside.com/books/wiley/masteringEJB/
    http://www.coreservlets.com

  • Where to put EJB design patterns?

    Im considering where to put the EJB design pattern classes and files.
    i.e. Facade, Data Access Objects, Transfer Objects, Delegate...
    I was thinking since the EJB business logics and implementation should be hidden from the user, then it is more logical to place these classes at the webapp.war inside of the ejb.jar.
    What are your thoughts guys?

    Photoshop patterns and normally stored in sets the set files have an extension of .pat.  You may also add individual patterns using menu Edit>Define Pattern.  In some Photoshop Pattern dialog you will see a little gear icon to open a Fly-Out menu in that menu there is a entry for Photoshop Preset Manager.  The are also other ways to get into the Preset manager.   In the preset manager you can manage many types of presets. Using its pull-down menu select patterns.  You can Load an save patterns sets.  To save a set tou heed to hilifht the paterns yoy want to include in the set.  You can also delete and rename patterns.

  • Design Concern Using PI

    Can any one tell me:  what way to call these kind of interfaces using XI:
    1. Our client using code1 applications for address check.
    we need to call these code1 applications through BAPI and send response back to BAPI.
    Code1 applications are third party applications and using custom build database.
    They are using some APIs(JAVA and C) for build this applications.
    My question is : Will XI able to call  these code1 applications using those APIs?
    FYI :If I see the code1 application ,its like front end screen.
    Flow like this:
    BAPI(Request)->XI----->Code1
    Code1(Response)XI----->BAPI
    I am looking for design concerns about this kind of integrations?
    Appreciated your time.
    Thanks,
    PILearn

    Hi,
    can you try using other tools like Altova XMLSpy or SOAP UI Client to send request to SOLMAN?
    If that works then it is some prob with the request from PI7.1 . If that does not work.. then you have to look at SOLMAN side what could be the problem.
    Regards
    Anand

  • EJB Design Patterns

    I picked up "EJB Design Patterns" by Floyd Marinescu. As I started reading through the book I began to wonder if these were standard patterns. So my question is this. Are the patterns described in this book accepted standards for design EJB's?
    Thanks

    Hi,
    You can check out the Core J2EE patterns at
    http://java.sun.com/blueprints/corej2eepatterns/index.html
    and also some examples and other strategies as applied in an application at
    http://java.sun.com/blueprints/patterns/catalog.html
    The Core patterns would be considered as the standard patterns and would probably help quite a bit.
    hope that helps,
    Sean

  • EJB Design Patterns Book Question

    I have been recently reading the EJB Design Patterns book by Floyd Marinesu.
    In one of the earlier chapters he says that 'entity beans are transactional creatures, each method call on an entity will require a separate transaction ..'.
    Surely this is wrong, if you are using CMT and mark your method transaction attribute as Required then if the calling bean has a transaction the called bean will use that transaction, rather then requiring a separate transaction.
    Someone please explain.

    Quoted out of context, the statement seems to be incorrect in some cases. IMO, the fact stressed is the "synchronization of the remote entity", which might have been loosely associated with a separate transaction.
    Here's the original quote.
    Furthermore, since entity beans are transactional creatures, each method call on an entity will require a separate transaction on the server side, requiring synchronization of the remote entity with its underlying data store and maintenance on behalf of the application server.
    Maybe Marinescu would answer that better :-)

  • EJB Design Query

    We have App A and App B which both need to access some common business objects. These business objects contain logic required to perform a specific function. Currently these are POJO's, and the access to them is done remotely by the applications via Stateless Session Beans. Currently we have 1 SSB per application. Some of these SSB's make the same method invocations on the business objects. It was a design assumption that when application logic was required it would be placed in the application specific SSB. Is this correct?, or should the SSB be generic ? containing generic methods to access the business objects? If there should be generic methods, how do we cater for the situation in which App B required different functionality to App B?

    To try and make my query more specific, lets look at 2
    scenarios.
    Well you said you had POJOs. If you are converting to EJBs then the code should probably be the same unless you intend to run different servers.
    Scenario 1:
    Lets assume that both apps call seperate EJB's with
    the same method signature but the implementation
    differs. Are you saying that this is OK, but not OK if
    we provide special cases within a shared/common EJB
    for the two applications?.
    For an EJB you would add a different signature. For POJOs then there is nothing at all shared so the point should not even come up.
    Scenario 2:
    Assume that the two seperate EJB's have the same
    method signatures and have the same implementation,
    which is to simply call methods in the common java
    business objects. In this case should the EBJ's be a
    common/shared EJB, even if we do not know if in the
    future they will differ (as in scenarion 1)?.For an EJB then you should be using the same server and thus the same EJB.
    For POJO if there is only one shared method in all of the code then I would keep them seperate. If you have hundreds then you need to start considering whether a common code base is needed (given the points I listed before.)

  • RMI & EJB design

    Hi,
    I am trying to design a RMI-J2EE architecture
    - The clients are Swing applications which communicate to the server via RMI.
    - The backend is a combination of xml-rpc based web-services and EJB components.
    What is an efficient scalable design for the RMI clients to access the backend.
    These are the constraints
    - Session handling is required
    - There may be firewalls so HTTP Tunneling may be required.
    - Performance, security and scalability are critical
    Essentially I am looking for a good J2EE design using Swing/RMI rather than HTML/JSP
    Regards
    George

    George,
    Sounds like you're working on our project here! ;oP We have the same requirements. Here's a wild idea. I have been thinking of other protocols suchs as WML for wireless served up via servlets which perform dynamic transformations from a standard XML content layout. I'm not sure how feasible or how it would scale but if you deal with the XML over on the server and doll out either HTML or WML depending on the client then you elliminate much of the bandwidth problems of XML/RPC. In other words you wireless client interacts purely via WML the same a browser would with HTML. The client becomes thin requiring no logic (outside of maybe Javascript but I don't know if that's an option with WML) however it puts a little more load on the server. Just one of my crazy ideas. I know little of WML outside of the fact that it works like HTML for wireless devices.
    Cliff
    george_t wrote,:
    DizzyDiz76 ,
    I have to use Swing/RMI because
    1) The clients are expected to reside on wireless
    devices and the swing application integrates with the
    device at a low level.
    2) I thought of using SOAP/XML-RPC but the network
    bandwith is at a premium and so a binary format such
    as RMI would be preferable to verbose XML.
    I was thinking if an architecture where the RMI
    clients talks to a RMI "controller" server on the app
    server is feasible? The controller can interact with
    EJB and return the results to the client. Have I
    missed anything obivious here? I do not have much
    experience with EJB/RMI.
    Regards
    George

  • Weblogic 6.1 JMS/EJB Design Question

    Any thoughts from gurus or those who have skinned their knees on similar
    issues would be GREATLY appreciated!
    Environment:
    Weblogic 6.1 sp3/Oracle 8.1.7 on Solaris
    I've got a webservice that invokes the webservice ejb and then delegates
    down to business layer ejb that delegates down to data layer dao classes
    that store off on average 150 records which include a clob field containing
    about 4k of data. (All in one JTA transaction) (I'll refer to this as
    operation 1)
    There is a logically independent process (parsing the clob data elements)
    that I'd like to kick off after all 150 records have been stored. (Needs
    access to the committed data) (I'll refer to this as operation 2)
    Questions:
    1. Can a stateless session ejb running under a single phase JTS transaction
    safely post a message to a JMS topic or queue running on the same weblogic
    instance?
    2. If so, are there any guidelines as to whether the transaction for
    operation 1 will complete before the sender receives notification? (the
    concern being that operation 2 will be notified but the data it is
    interested in will not be visible yet) If no guarantees, would configuring
    a JMS message delivery delay help?
    3. This operation will get invoked perhaps a thousand times a day, and I'm
    fearful of falling into the message redelivery trap from transaction
    rollbacks which possibly could occur from operation 2. Above all else, I
    care about NOT having the queue get clogged up with resends. Given that
    bias, should I use NOTSUPPORTED then have the session bean that the MDB
    delegates to start a transaction or would using BMT from the MDB be more
    correct?
    4. Any other thoughts?
    Thanks!

    Alan May wrote:
    Any thoughts from gurus or those who have skinned their knees on similar
    issues would be GREATLY appreciated!
    Environment:
    Weblogic 6.1 sp3/Oracle 8.1.7 on Solaris
    I've got a webservice that invokes the webservice ejb and then delegates
    down to business layer ejb that delegates down to data layer dao classes
    that store off on average 150 records which include a clob field containing
    about 4k of data. (All in one JTA transaction) (I'll refer to this as
    operation 1)
    There is a logically independent process (parsing the clob data elements)
    that I'd like to kick off after all 150 records have been stored. (Needs
    access to the committed data) (I'll refer to this as operation 2)
    Questions:
    1. Can a stateless session ejb running under a single phase JTS transaction
    safely post a message to a JMS topic or queue running on the same weblogic
    instance?So is the first transaction going to be writing 150 records to the
    database and the publishing a JMS message? Yes, this can all be one in
    one transaction in WLS, but it will be a XA/2PC transaction. I'm
    curious why you specified single-phase?
    >
    2. If so, are there any guidelines as to whether the transaction for
    operation 1 will complete before the sender receives notification? (the
    concern being that operation 2 will be notified but the data it is
    interested in will not be visible yet) I'm not sure I follow you here. If the message publish is part of the
    transaction then no consumer will receive the message before the publish
    transaction commits.
    If no guarantees, would configuring a JMS message delivery delay help?
    3. This operation will get invoked perhaps a thousand times a day, and I'm
    fearful of falling into the message redelivery trap from transaction
    rollbacks which possibly could occur from operation 2. There's 2 important WLS JMS features I would suggest you look into:
    1) Message redelivery delay & limits
    2) Error destinations
    Take a look at
    http://e-docs.bea.com/wls/docs81/jms/implement.html#1255066
    Above all else, I
    care about NOT having the queue get clogged up with resends. Given that
    bias, should I use NOTSUPPORTED then have the session bean that the MDB
    delegates to start a transaction or would using BMT from the MDB be more
    correct?I think you'd be better off using redelivery limits and delay than
    trying to do the JMS acknowledgement and transaction management yourself.
    -- Rob
    >
    4. Any other thoughts?
    Thanks!

  • To EJB or Not to EJB (Design Question)

    Hello,
    New to EJB i am devlepoing a simple test App. Your suggestions will be very valuable.
    Test App..
    - Authenticate process
    - Search for Orders
    Our compnay policy forces that We must validate the sessionID (created internally) on every page call. Expected Client maybe Web srvices/servlet/JSP. Multiple users and heavy traffic expected.
    My Design...
    - Make Stateless Session EJBs for Authentication
    - Make Stateless Session EJBs for Orders search. Number of functions will be exposed for searching.
    Questions
    - Does it make sense to wrap all the SQL select calls in SESSION EJB? or should i call from JSP directly
    - IS SEESION EJB for authentication is the right choice
    - which is the best place for using Entity EJBs
    Regards
    H

    A good app. design would be as follows:
    Use three "Application Layers"
    1. PRESENTATION LAYER: this layer includes
    -JSP (only for view purposes!!!)
    -FrontController (Pattern usally implemented as Servlet for handling authentication/authorisation AND session handling!!!!!!)
    -ServiceDispatcher (Pattern for dispatching ;-))
    -BusinessDelegate (for encapsulation from the BUSINESS LAYER)
    2. BUSINESS LAYER: this layer includes
    -SessionFacade (usally Stateless Session Beans for your needs for example order!!!)
    3. PERSISTENCE LAYER: this layer includes
    -EntityBeans (CMP or BMP you must decide wich is better for your needs....I prefer BMP, it is more coding, but you are not dependent on app. server provider....CMP runs faster!!!!)
    -DataAccessObject (DAO--> here are your sql-statements and db-connections)
    For all Patterns here look at this side for more information
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/
    TIP: Use the Session API for your session handling!!!!!!!!!!!!
    Regards
    howmad23

  • EJB Performance Concern

    Hi ALL
    I am designing an application following EJB Command Pattern.
    The Client (Swing Client) gets reference to the command server and passes the command object.
    When execute method is called on this CommandObject, this will in turn call other session beans and gets it work done fills up the CommandObject (which in this case is also a data transfer object) returns to the client.
    Since every time I need to lookup the session beans in commandobject execute method, will it slow down my system. or since the commandobject and other session beans are on the same machine is it ok.
    Do i have to specify something to say that these session beans that my commandobject is accessing is local.
    Please let me know.
    Thanks
    Modha/-

    Hi modha,
    your beans should have both local and remore interfaces and in the source of your command you should lookup the local home interface you need. Where must you specify the JNDI name of local/remote interface? This is a typical doployment time problem and each AS has its vendor specific tool to di it. For instance, weblogic has its builder by which you specify such information and it generates all the ejb-jar.xml, ... files. Why this is a typical doployment time (and not development time) problem? Because a developer could not know that he/she is binding one of his/her beans to a JNDI name already used by onother developer ... here the deployer comes ... In particular, is case of name collision the deployer can use ejb references with JNDI symbolic name.
    bye

  • EJB Design

    I have a design question - which is better, a stateless session bean or a read only entity bean?

    I stand corrected! You're right Abhishek, they can't be accessed concurrently. One client is mapped to one stateless session bean but that mapping isn't fixed.
    According to Section 7.8 of the EJB 2.0 PFD2:
    "Because all instances of a stateless session bean are equivalent, the container can choose to delegate a client-invoked method to any available instance. This means, for example, that the Container may delegate the requests from the same client within the same transaction to different instances, and that the Container may interleave requests from multiple transactions to the same instance."
    My statement that stateless session beans are never passivated still holds.
    Anyway...
    It would be kind of weird to have some sort of read-only EntityBean. I'd much rather store that "data" as a static final (yes, it's allowed) member of a stateless SessionBean. But then again, that seems weird too (but a little less so).
    Again, it depends on whether that data changes or not and, if it does change, how often and how it is updated.
    You could even put it up in a directory (JNDI) to save on EJBs! (A bit extreme, though.)
    It really depends on the intended use...

  • Design Concern for XI Scenario!

    Hi All,
    Do you have any design solutions for following scenarios with respect to BPM,Adapaters and sync/async flow:
    1. JSP -
    > XI---->DB
    2. JSP<--->SAPR/3<->XI<--->DB
    3. DB-->XI->JSP
    4. JSP<->XI<--->DB
    Appreciated your  time! Will get you reward!
    Thanks,
    PILearner.

    I want to add more scenarios like
    oracle -
    xi--.NET--
    R/3
    and more hetrogeneous environment
    Does any one know simple case studies or how to guides for hetrogenity in XI

  • EJB Design  Pattren For File Transfer Application

    hi,
    My requirement is Transfer of large files (around 300-500KB) across the network with a central repository.We looking at a Solution from J2EE With EJBs.
    At the Central Repository we are looking for ejb-Application Server. But the the issues i come acorss for my requirement are
    1.I need to store and access Files on the local hard Disk with ejbs
    >> But ejb spec won't allow to access the local file System
    2.Based on the certain rukes i need to forward the files to different location
    >> But ejb Won't allow to use Sockets in EJB.
    I Want to know is there any work around in EJB to meet my requirements.
    Any suggestions and ideas are welcome.
    Regards
    Srinivas

    Thanks For Your Feedback. I Will Explain my Requirement more elobarate.
    Our System Arch Looks like this
    The Current System
    |--MiniServ1--Client
    Source---Central Server--|--MiniServ2 --Clients
    | |--MiniServ3--Clients
    Data Base
    ------ Bidirectional Link
    Central Server --With database about all the transcations through the System
    Mini Serv*--with Storage info of teh files came to that Server
    Where Source / End Elients are Windows Based Clients(Developed in VC++)
    The File Size Transfering across different Sources is of Size around 0.5 MB.At the Central Server these Files Will be Stored on the local hard Disk.At Centarl Server based on Some Rules it will be routed through different Mini Servers(Mini Serv*).Mini Server Will Send the file to different Clients. After Working on the files the files will be send back to the central Server via the Mini Server*.At the Central Server we have the latest Copy of the File
    Currently Entire System Based on Windows and Central Server Built using COM Components Running on Windows 2000 Advanced Server.
    The Problem
    We Want to port the existing Sytem in java with out touching the Source and End Clients.We thought of replacing the Central Server with J2EE Application Serevr and COM Components with EJBS.But in Ejb we can't write to Local System and can't use sockets to send the files to MiniServers.
    Is there Any Work Around for the mentioned problem using java?

Maybe you are looking for

  • I can't use FaceTime after upgrading to Lion!

    Hi, Yesterday I upgraded my MacBook to Lion, and afther I upgraded FaceTime does not work. I used it prior to my upgrade, and it worked perfect. I have a neew macbook pro 13" 2,3ghz bought on sunday, so its brand new!! When I try to use FaceTime I lo

  • Agents not installing properly on certain domain device.

    Hi,    We are having troubles pushing clients to machines in a specific domain.    It looks like the agents install ok but they dont communicate to the management point.  The domain the mp is in is trusted with the domain I am trying to push clients

  • Performance problem when using CAPS LOCK piano input

    Dear reader, I'm very new to Logic and am running into a performance problem when using the CAPS LOCK-piano-keyboard for input of an instrument: when I'm not recording everything is fine and the program instantly responds on my keystrokes, but as soo

  • JtreeTable - Nodes update issue - Nodes are cut off

    Hi, I'vet got a little problem with the JtreeTable. Everything works fine until I try to change the rendering of a row to BOLD. The text turns bold, but the TreeNode (first col in row) is cut off because it was first rendered plain and now its to big

  • DOWN key of the keyboard in a JTABLE

    I want that the DOWN key of the keyboard doesn't provoke the passage of a line to another in a JTABLE, I want that she executes something else.