Web Dynpro DC vs. EJB

Hello all,
I want to create a central method for connecting the DB from WebDynpro.
In some of the documents its recommended to create an EJB for that purpose.
Can anyone tell me why is it more recomended than using a webDynpro DC?
Thanks, Adi.

Hi,
  I was put up with the same question but i went for a Java DC, which inturn is consumed in an EJB.
One simple reason is:
An application can have webdynpro components and regulat java components (say Java DC). A Java DC can be consumed in a webdynpro DC but a webdynpro DC (say you have implemented the connection configuration in Controller) cannot be consumed in Java DC.
So for having a single point of control on DB Connection for webdynpro and java components we generally go for a Java DC component which will provide connection (JDBC and RFC).
Hope that helps.
Regards,
S.Divakar

Similar Messages

  • Web Dynpro Tables from EJB

    I am new to Web Dynpro and I'm trying to write an application that displays data from and EJB in a table in web dynpro.  The EJB returns an array "items[]" to my command bean.  Is there a way to create a table based on the array "items[]" and several properties of the item.

    Hi Jonathan,
    If the properties of the items are static (i.e. not going to change in the course of time), you can create Table with fixed TableColumns (no. of Table columns = no of properties of item) which has TableCellEditor which can be TextView if the data is display only.
    You have to also create context structure which has root node and attributes corresponding to each of the property of item and bind the node to datasource property of Table and bind attributes to each TableCellEditor(TextView's text attribute).
    Just populate the data from your bean to the context creating nodeElements for each item and setting contextAttribute value as the property value.
    Refer https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/bad3e990-0201-0010-3985-fa0936d901b4 for table
    If the properties are dynamic (i.e. changing due course of time). You can create the TableColumns, TableCellEditors dynamically and also the context attributes dynamically in wdDoModifyView.
    Refer Dynamic table column creation for more details
    Hope this helps.
    Thanks and Regards,
    Rohit Jaiswal

  • Couldn't complete tutorial u0091Integrating EJB 3.0 into Web Dynpro ... '

    Hi All,
    I am trying to complete the “Integrating EJB 3.0 into Web Dynpro Using the EJB Model Importer” tutorial that goes with SAP NetWeaver Composition Environment 7.1 SP3 Developer Studio.
    Does anyone ever completed this tutorial because I have problems completing it. The result is very important for me because I need to use this technology for my essay.
    In this tutorial you create a button that calls the method StudsBean.getStudent(String). In this method the object student is created and it will be returned. In several labels the information of the returned student should be displayed. But that doesn’t happen, when I push the button no error occurs but the labels are still empty. When I try to debug the Enterprise Bean and Web Dynpro application I see that the method StudsBean.getStudent(String) is called and the property’s are set and the student object is returned, but still it isn’t displayed.
    After discussing this with a colleague I tried to search for a solution on the SDN and of course Google. First I thought I would be a bug but I only found 2 people with the same problem. I found it remarkable because it’s one of the key subjects of Java EE 5 and it’s a tutorial displayed in the welcome page of the Developer Studio.
    So do you people think it’s a bug in WebDynpro? Because I am sure that I followed all the steps mentioned (a colleague checked it even).
    Regards,
    Sander

    Hi Vesselin,
    Thank you for the quick replay, this is the code I'm using:
    public void onActionGetStudent(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionGetStudent(ServerEvent)
              try {
                  // executes the corresponding method on the session facade
                  wdContext.currentRequest_StudsLocal_getStudentElement().
                  modelObject().execute();
                  // forces Web Dynpro to re-create the Request model object
                  // in order to clear the InputField
                 wdContext.nodeRequest_StudsLocal_getStudent().invalidate();
                  // updates the UI elements bound to the Response node
                  wdContext.nodeResponse().invalidate();
                  //Code for trying something out
                  //wdContext.nodeReturn().invalidate();
                  //wdContext.nodeAddress().invalidate();
               } catch (Exception e) {
                  throw new RuntimeException(e);
    Have you tried this example yourself, or is replay based on experience?
    Kind Regards,
    Sander

  • Couldn't complete tutorial 'Integrating EJB 3.0 into Web Dynpro ...'

    Hi All,
    I am trying to complete the “Integrating EJB 3.0 into Web Dynpro Using the EJB Model Importer” tutorial that goes with SAP NetWeaver Composition Environment 7.1 SP3 Developer Studio.
    Does anyone ever completed this tutorial because I have problems completing it. The result is very important for me because I need to use this technology for my essay.
    In this tutorial you create a button that calls the method StudsBean.getStudent(String). In this method the object student is created and it will be returned. In several labels the information of the returned student should be displayed. But that doesn’t happen, when I push the button no error occurs but the labels are still empty. When I try to debug the Enterprise Bean and Web Dynpro application I see that the method StudsBean.getStudent(String) is called and the property’s are set and the student object is returned, but still it isn’t displayed.
    After discussing this with a colleague I tried to search for a solution on the SDN and of course Google. First I thought I would be a bug but I only found 2 people with the same problem. I found it remarkable because it’s one of the key subjects of Java EE 5 and it’s a tutorial displayed in the welcome page of the Developer Studio.
    So do you people think it’s a bug in WebDynpro? Because I am sure that I followed all the steps mentioned (a colleague checked it even).
    Regards,
    Sander

    Hi Sander,
    I guess, it's not a bug in Web Dynpro, maybe it's a bug in the tutorial
    I tried something similar, but not following the tutorial and it works. I wasn't able to call the model from the view controller and I guess that's the problem. Take the code from the init-method of the view controller and put it to the component controller's init -method and the code inside the onActionGetStudent and put it into a method you create in the component controller, too. From onActionGetStudent just call this method in the component controller with some code like this:
    wdThis.wdGet<your component controller's name>.<your method's name>;
    Hope this helps
    Kind regards
    Stefanie

  • Can Write Full business logic in web Dynpro ?

    Hi All
           We are developing many Iviews with WebDynpro and
           same time where we need to write the pure business logic ?
           Can we write in Web Dynpro ? Any issues on this ?
    Any one can help me on this pl
    regards
    rakesh

    At a purely technical level, then you can of course write business login in Web Dynpro - after all, it is still just Java (or ABAP). The real question here is whether that is a good idea.
    I think that Web Dynpro works best as a presentation and application-flow framework - actual business logic is best implemented in another layer. This can be done in EJBs in Java, but in most SAP landscapes my experience is that the business logic layer is best implemented in ABAP, since the ABAP back-end is most naturally the place where all business logic exists. Of course, if you only have Java developers and you are using Java Web Dynpro, then an EJB-based business logic layer may be more comfortable to implement.
    Hope this helps,
    Darren
    <a href="http://www.fortybeans.com/">blog</a>

  • Error while importing EJB model in Web dynpro: Unable to fetch the EJBs.

    Hi,
    We are getting the below error while importing ejb model to Web dynpro.
    Error :
    Unable to fetch the EJBs. Check if the selected Enterprise Application contain the EJBs.
    I have created the public part-> It has a reference to EJB client and the enterprise application also has reference to the EJB project.The EJB is also added in dependency list.
    But still we are getting this error. Could anyone please explain what can i do to solve this issue.
    Best Regards,
    Karthika

    Hi Vishweshwara,
    Thanks for your reply.
    Please find the steps i followed while importing EJB model in webdynpro.
    1. The Entity forwarding permission has been enabled.
    2. public part reference has been created and through the reference entity option the ejbDC->Client public part is selected.
    I followed all the steps mentioned in the document. But still i am getting that error. In EJB DC we have list of JPA entities and stateless session beans are exposed as a webservice(top-down manner).The enterprise application has a reference to the EJB DC.
    I could be able to invoke the ejb service beans from ejb explorer and Webservice navigator.
    I am able to insert,delete and modify the records from there.
    Please let me know what could i do to resolve this error?
    Best Regards,
    Karthika
    Edited by: SAKarthika on Apr 29, 2011 1:43 PM

  • Using EJBs in Web Dynpro

    I have recently started to develop Web applications using the Web Dynpro framework. Coming from a pure J2EE world, I must admit that Web Dynpro has a few innovative features that I find interesting for user interface development. The use of component & view contexts, for example, is not unlike the ActionForms that one may find in a Struts application, but pushed a bit further. No complaints here.
    What I do have some problems with is the whole CommandBean paradigm that is put forth by SAP (refer to the document <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/using%20ejbs%20in%20web%20dynpro%20applications.pdf">Using EJBs in Web Dynpro</a>).
    I do understand the usefulness of defining a model that will be used to generate and eventually bind to Context data structures. That's fine. What I do object to is the use of a so-called CommandBean to play that role. Again, coming from a J2EE world, I am familiar with the BusinessDelegate pattern - which would typically be used by a client application to invoke business logic on the server side. I would propose that a better, cleaner way of integrating EJBs with the Web Dynpro framework would be to use a BusinessDelegate for invoking business logic, and importing a separate and distinct ModelBean (instead of a CommandBean) to be used for defining and binding to Context data.
    I have built one Web Dynpro application thus far. Instead of using a CommandBean, I created a ModelBean that extends my business object DTO (Data Transfer Object) (which is quite appropriate for that role, given that it implements all the get & set methods that are required for the business data that I need to model). My Web Dynpro application also makes use of an independant BusinessDelegate that is packaged with my EJB DC - this is a standard best practice on J2EE projects. I have been asked by the people working with me to modify this architecture to bring it more in line with the SAP way of doing things. I am open-minded and willing to learn and accept new ways of thinking and doing things. However, I fail to understand the usefulness of merging structure and behaviour by resorting to CommandBeans:
    - <b>It violates the MVC paradigm</b> by having one object (the CommandBean) serve as both model AND controller as far as the Web Dynpro application is concerned. The CommandBean is obviously a model - since it is literally imported as such into the Web Dynpro application. It is ALSO a controller from the Web Dynpro's application perspective, since all calls to the back-end go thru the CommandBean via one or more of its execute_xxx methods. In contrast, the use of a business delegate by the Web Dynpro application clearly separates the model (the CommandBean... or rather, a more suitably named ModelBean) from the controller (BusinessDelegate).
    - <b>Doesn't carry its own weight.</b> In other words, I haven't yet been provided with any valid justification for going thru the extra effort of coding the CommandBean's execute methods. It's been proposed to me that it somehow serves as an abstraction layer between the Web Dynpro application and the business logic. I would argue that it is the BusinessDelegate's role to abstract away the back-end logic from clients. If one does have a BusinessDelegate available, I would argue there's no need to code execute methods in a separate CommandBean. To prove my point, I would simply point out that all of the CommandBean examples that I have seen so far, either in How-To documents, or in production code, all follow the same pattern....
               CommandBean.execute_doSomething() calls BusinessDelegate.doSomething()
    Not a heck of an "abstraction" layer... I would in fact argue that it is worse than useless. If some major change occurs in the business logic that requires changing the doSomething() operation, we expect of course to modify the BusinessDelegate. The Web Dynpro client will also presumably need to be modified - that's to be expected, and unavoidable. But then, we'll also need to go about and change the CommandBean's execute_doSomething() method - again, extra work for no apparent benefit. Adding and removing business methods has the same implication. All this for an layer that simply adds the prefix execute_ in front of all business method calls... Is this "abstraction layer" worth the cost of creating and maintaining it ??
    - <b>Unnecessarily complicates error handling</b>. I have been told that for technical reasons, it is recommended that all exceptions thrown by the CommandBean be of type WDException or WDRuntimException. But what if the client application needs to react differently to different failure scenarios ? When I create a business object, I might wish to provide the user with an error messages if connection is lost to the backend, and with a different error message if an object already exists in the database with the same attributes. In order to do that, I will have to catch the WDException, extract the cause, and continue processing from there... possible, yes, but clearly less standard and more labor intensive than the classical try/catch mechanism.
    To say nothing about the fact that SAP's own API documentation clearly states that applications using Web Dynpro can reference and catch WDExceptions, but THEY MUST NOT THROW OR EXTEND IT !
    - <b>Produces unnecessary DCs</b>. Page 6 of the aforementioned document presents an architectural view of a Web Dynpro project that uses a CommandBean. Why an extra DC for the CommandBean ?? I created my ModelBean class right inside the Web Dynpro project (in the Package view). That, to me, is where this class should reside, because it is created for no other reason that to be used by this particular Web Dynpro application. What is the benefit of placing it in its own independant DC ?
    - <b>Not a typical application of the Command pattern</b>. The well-documented command pattern (Design Patterns - Gang of Four) has been devised mainly to enable encapsulation of request as objects, thereby making it possible to:
    - specify, queue and execute requests at different times
    - decouple execution of a command from its invoker
    - support undo operations
    - support logging changes so that they can be reapplied in case of system crash making it possible to assemble commands into composite commands (macros), thereby structuring a system around high-level operations built on primitive operations.
    None of this applies to the way the SAP CommandBeans are being used. Not that much of an issue to people new to J2EE and/or OO development... but quite confusing for those already familiar with the classic Command pattern.
    At this point, I fail to understand the advantage of merging structure (model) and behaviour (execute methods) through the use of a unique CommandBean object. Am I missing something ?

    Thanks for your reply and your suggestion. I have posted in the Web Dynpro Java forum... and suggest those wishing to participate in this thread to refer to the Web Dynpro Java forum.
    As for your answer, I'm afraid it doesn't satisfy me.
    Reuse is hardly an issue, since the CommandBean is specifically tailor-made for the Web Dynpro application that needs to use it. I could hardly imagine building another application that would just happen to have the exact same needs as far as data structure and processing is concerned...
    As for the right Eclipse environment... the CommandBean is not an EJB artifact - it is an EJB client. The aforementioned tutorial in fact suggests creating it in the Java perspective.
    But thanks anyway for your time and suggestion

  • Using EJBs in Web Dynpro Applications

    I have recently started to develop Web applications using the Web Dynpro framework. Coming from a pure J2EE world, I must admit that Web Dynpro has a few innovative features that I find interesting for user interface development. The use of component & view contexts, for example, is not unlike the ActionForms that one may find in a Struts application, but pushed a bit further. No complaints here.
    What I do have some problems with is the whole CommandBean paradigm that is put forth by SAP (refer to the document <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/using%20ejbs%20in%20web%20dynpro%20applications.pdf">Using EJBs in Web Dynpro Applications</a>).
    I do understand the usefulness of defining a model that will be used to generate and eventually bind to Context data structures. That's fine. What I do object to is the use of a so-called CommandBean to play that role. Again, coming from a J2EE world, I am familiar with the BusinessDelegate pattern - which would typically be used by a client application to invoke business logic on the server side. I would propose that a better, cleaner way of integrating EJBs with the Web Dynpro framework would be to use a BusinessDelegate for invoking business logic, and importing a separate and distinct ModelBean (instead of a CommandBean) to be used for defining and binding to Context data.
    I have built one Web Dynpro application thus far. Instead of using a CommandBean, I created a ModelBean that extends my business object DTO (Data Transfer Object) (which is quite appropriate for that role, given that it implements all the get & set methods that are required for the business data that I need to model). My Web Dynpro application also makes use of an independant BusinessDelegate that is packaged with my EJB DC - this is a standard best practice on J2EE projects. I have been asked by the people working with me to modify this architecture to bring it more in line with the SAP way of doing things. I am open-minded and willing to learn and accept new ways of thinking and doing things. However, I fail to understand the usefulness of merging structure and behaviour by resorting to CommandBeans:
    - <b>It violates the MVC paradigm</b> by having one object (the CommandBean) serve as both model AND controller as far as the Web Dynpro application is concerned. The CommandBean is obviously a model - since it is literally imported as such into the Web Dynpro application. It is ALSO a controller from the Web Dynpro's application perspective, since all calls to the back-end go thru the CommandBean via one or more of its execute_xxx methods. In contrast, the use of a business delegate by the Web Dynpro application clearly separates the model (the CommandBean... or rather, a more suitably named ModelBean) from the controller (BusinessDelegate).
    - <b>Doesn't carry its own weight</b>. In other words, I haven't yet been provided with any valid justification for going thru the extra effort of coding the CommandBean's execute methods. It's been proposed to me that it somehow serves as an abstraction layer between the Web Dynpro application and the business logic. I would argue that it is the BusinessDelegate's role to abstract away the back-end logic from clients. If one does have a BusinessDelegate available, I would argue there's no need to code execute methods in a separate CommandBean. To prove my point, I would simply point out that all of the CommandBean examples that I have seen so far, either in How-To documents, or in production code, all follow the same pattern....
    CommandBean.execute_doSomething() calls BusinessDelegate.doSomething()
    Not a heck of an "abstraction" layer... I would in fact argue that it is worse than useless. If some major change occurs in the business logic that requires changing the doSomething() operation, we expect of course to modify the BusinessDelegate. The Web Dynpro client will also presumably need to be modified - that's to be expected, and unavoidable. But then, we'll also need to go about and change the CommandBean's execute_doSomething() method - again, extra work for no apparent benefit. Adding and removing business methods has the same implication. All this for an layer that simply adds the prefix execute_ in front of all business method calls... Is this "abstraction layer" worth the cost of creating and maintaining it ??
    - <b>Unnecessarily complicates error handling</b>. I have been told that for technical reasons, it is recommended that all exceptions thrown by the CommandBean be of type WDException or WDRuntimException. But what if the client application needs to react differently to different failure scenarios ? When I create a business object, I might wish to provide the user with an error messages if connection is lost to the backend, and with a different error message if an object already exists in the database with the same attributes. In order to do that, I will have to catch the WDException, extract the cause, and continue processing from there... possible, yes, but clearly less standard and more labor intensive than the classical try/catch mechanism.
    To say nothing about the fact that SAP's own API documentation clearly states that applications using Web Dynpro can reference and catch WDExceptions, but THEY MUST NOT THROW OR EXTEND IT !
    - <b>Produces unnecessary DCs</b>. Page 6 of the aforementioned document presents an architectural view of a Web Dynpro project that uses a CommandBean. Why an extra DC for the CommandBean ?? I created my ModelBean class right inside the Web Dynpro project (in the Package view). That, to me, is where this class should reside, because it is created for no other reason that to be used by this particular Web Dynpro application. What is the benefit of placing it in its own independant DC ?
    - <b>Not a typical application of the Command pattern</b>. The well-documented command pattern (Design Patterns - Gang of Four) has been devised mainly to enable encapsulation of request as objects, thereby making it possible to:
    - specify, queue and execute requests at different times
    - decouple execution of a command from its invoker
    - support undo operations
    - support logging changes so that they can be reapplied in case of system crash making it possible to assemble commands into composite commands (macros), thereby structuring a system around high-level operations built on primitive operations.
    None of this applies to the way the SAP CommandBeans are being used. Not that much of an issue to people new to J2EE and/or OO development... but quite confusing for those already familiar with the classic Command pattern.
    At this point, I fail to understand the advantage of merging structure (model) and behaviour (execute methods) through the use of a unique CommandBean object. Am I missing something ?

    Hi Romeo,
    You would be disappointed, this reply ain't anywhere nearby to what you are talking about...
    I wanted to mail you, but you have not mentioned your email in your profile.
    I am really impressed by your flair for writing. It would be far better had you written a blog on this topic. Believe me, it would really be better. There is a much wider audience waiting out there to read your views rather than on the forums. This is what I believe. To top it, you would be rewarded for writing something like this from SDN. On the blogs too, people can comment and all, difference being there you would be rewarded by SDN, here people who reply to you would be rewarded by you. Doesn't make  much a difference.
    Anyways the ball is still in your court
    As far as I am concerned, it has still not been much time since I have started working on Web Dynpro. So can't really comment on the issue...
    Bye
    Ankur

  • Importing EJBs into web dynpros

    I have created EJBS and I would like to use these EJBs in
    web dynpros. How do I do it.
    I think I can create a jar file for the EJBS and reference them in my Web Dynpro project but I think that is not the right way to do it.
    Thanks,
    PKK.

    Hi Simon + Praveen,
      I will try to walk you through how to do it but I think you may need a bit of experience with EJB's, Web Dynpro and NWDS to understand it right away. <i>The following assumes you have created a session and entity bean.</i>
    First you need to make sure your table is deployed in the database that you created(dictionary perspective).
      Second deploy your EJB (.ear file) to the J2EE engine (J2EE development perspective)
      Third switch to Web Dynpro perspective and goto your project properties (right click on the project and click properties)
       Now goto Java Build Path - libraries - add external jars and add the EJB-Jar file. then choose the tab called "order and export" and move the jar file to the top.
    <b>THIS IS A LITTLE TRICKY</b>. Next you need to add the sharing reference. In the same properties wizard where you add the java build path select Web Dynpro References and then select the Sharing references tab. Click on Add and enter the vendor name and name of the ear file like this <vendor name>/<name of the ear file>, This is how your web dynpro knows where the ear file is on the j2ee engine. <b>IF YOU ARE NOT SURE WHAT IT IS</b> you need to access the J2EE visual administrator. and goto SERVER 0/Services/Deploy then select the "runtime" tab then look under <i>Server 0/EJBContainer</i> save all your meta data. your WD application now accesses your EJB logic.
    Good luck!!
    -wael
    *plz dont forget the rewards?

  • Using EJB Model in Web Dynpro

    I have to redeploy my EJB.ear (used as a Web Dynpro model) everytime the J2EE server is started (only the first time), after which My Web Dynpro program continues to work. In other words, the following code in my Command Bean is not successful without redeploying the EJB.ear for some reason. Can someone please tell me what I am doing wrong ?
    home = (MyLocalHome) context.lookup("localejbs/MySessBean");

    Walter, thanks for the reply.  When I checked the EJB Container in VA after starting up the J2EE server, my EJB shows a blue check mark already with the START button grayed out (STOP button is active).  So I would think the EJB is started already...  HOWEVER, I noticed that when I hit the DEPLOY button there, I see a warning message popping up which says :  "This Application hasn't J2EE modules, so it cannot be loaded. Proceeding with Deploy".  I go ahead and finish the Deploy and then my EJB works.  It seems I am not including a module when I deploy it ?
    Paul

  • Expose EJB through Java Bean model importer in Web Dynpro

    Hi,
    I am planning to expose EJB like following:
    1. Create Stateless session bean as a façade for DAO access.
    2. Create DAO to access database. In my case is Oracle DB
    3. Create Java Bean to encapsulate session bean
    4. Import java bean model to web dynpro
    Few of my business method return the object array e.g. Customer[] which contains all properties of customer, and getter, setter.
    Has anyone done this before? Is there any sample code?
    Best Regards,
    Zhang Yan

    Hi
    I think u can refer to the following link
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/simple java bean generator for database.pdf
    Thought this link is also Useful
    Creating and Deploying Web Services for an EJB
    Wishes
    Krishna kanth

  • Using EJBs in Web Dynpro and others model tecnology patterns

    I'm having difficults in order to implement the business logic in Java.
    I did a simple application and I put all business rules inside de controller in the web dynpro. Everything is ok to users, but I know that this isn't indicate.
    I tried to encapsulate de business rules and dao in a session bea, but I'm not sucessfull. I'd like to receive advices/tutorial about model, I found some treads in the forum, but almost all links in the sdn are browke. I was thinking in using hibernate and spring, but I don't know with it's a good choive to sap world.

    Hi,
    try these tutorials:
    (ejb) https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c
    (hibernate) https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/14f55178-0801-0010-0bac-974ed17e51d3
    Regards
    Ladislav
    PS. Consider rewarding helpful answers

  • DB access in Web Dynpro Portal Service / or EJB with WebService ?

    Hi,
    I will develop a web dynpro application which will run in the EP and use an DB. How are the best practices in this scenario ? Should I use a Web Dynpro Model (EJB or WebService) for the persistence operations or should I use Portal Services ?
    Regards
    Flo

    Thanks,
    ok some words more... , I want to find out the differences between VC, PDK and Web Dynpro. Most of the parts of the application will be written in Web Dynpro. It´s possible to access portal services in Web Dynpro. But not with a Web Dynpro Model, so will going to use EJB/Webservice.
    But here I have one more question... I am wondering why EJB a n d Webservice in combination !?!? Can´t I only write a Webservice o r a EJB to achieve the DB connectivity ?
    Thanks
    Flo

  • Oracle or MS SQL Server, EJB Models and Web Dynpro Application

    Hi
    I've a table in MS SQL database. I've created in Visual Admin, the datasource(jdbc/MyAlias) for the above. SQL Server has Employee Table with EmpId, FirstName, LastName and Description as its Columns.
    I want to display, modify , insert and delete entries from the Employee Table using web Dynpro. For this we have used JDBC method by which we create class file which will have JDBC connectivity and logic for getting data from backend. This class file then used for display, update and other operations. And the context is built at design time.
    This is not proper method, as this doesn't come under perview of MVC concept.
    I want to use EJB Models for this case. But I'm stuck with some problems.
    1. How do I implement EJB models in this scenario.
    2. How do EJB module (entity bean) connects to external database.
    3. What are the most logical steps to be used in this case.
    Any pointers for this will greatly appreciated with points?
    So far I was able to do create EJB module of Entity Bean type with all interfaces. But beyond this I'm not able to proceed. Do let me know the step wise procedure for this kind of scenario.
    Thanks
    Srikant

    Hi Srikant,
    I have worked on similar stuff, but the scenario was a little different. I worked on creating Web Services using EJBs, but the basic part was that, the web service was supposed to interact with the SQL Server database. So maybe I can help you...
    First thing which is needed is that you have created the JDBC Connector in your Visual Administrator correctly. If you wish to cross check, you can see my answer in the following thread:
    JDBC error
    In this thread itself I have given the code which is the solution to your problem (this is what i believe). I am pasting the code again:
    <b>InitialContext initialContext = new InitialContext();
    DataSource dataSource = (DataSource)initialContext.lookup("jdbc/MyAlias");
    java.sql.Connection connection = dataSource.getConnection();</b>
    You can use this code in the method of your EJB, and then you can easily use this connection object to access your database tables using SQL queries.
    And if by any chance you are looking for a step wise procedure for creating a web service from an EJB, then give me your email address, i will send you the doc.
    Bye
    Ankur
    Do reward points if it helps!!

  • WEB DYNPRO AND WEB SERVICE MODEL: ejb remove doesn't work

    Hi guru,
    this is my scenario:
    J2EE-7.00 SP14-> PORTAL ->7 sp14  ->WEB DYNPRO FOR JAVA ->Web Service Model ->  WS Custom with MDM API JAVA
    The my WS is a Stateless Session Bean and i have this code:
         public void ejbCreate() throws CreateException {
              loc.setMinimumSeverity(Severity.INFO);
              loc.addLog(new ConsoleLog());
              this.plug = (MdmPlug) new MdmPlug(true);
              try {
                   this.loadProperties();
                   this.plug.connect(
                        hostname,
                        repository,
                        language,
                        username,
                        password);
                   loc.fatalT(msgLog+"[ ejbCreate ] START....");
              } catch (Exception e) {
                   if (e.getMessage()!=null)this.error=e.getMessage();
                   loc.fatalT(msgLog, this.error);
    public void ejbRemove() {
              try {
                   loc.fatalT(msgLog+"[ ejbRemove ] STOP....");
                   this.plug.close();
                   loc.fatalT(msgLog+"[ ejbRemove ] ...OK");
              } catch (ControlException e) {
                   loc.fatalT(msgLog+"[ ejbRemove ] ...K O !!!!");
    The my problem is:
    When open the IE and open my WD  the new EJB's instance is created (I see my log +"[ ejbCreate ] START....in LOG VIEWER).
    But, when I do log-off or I close IE, I don't see "[ ejbRemove ] STOP...." in LOG.
    Result:
    I open the MDM connection but not close it.
    Where is the problem?
    In Web Dynpro?
    In Web services?
    I have to create another WS's type?

    Hi Max,
    You can't run an EJBControl from a simple java class using either @Control or programmatic instantiation.
    The EJBControl implementation relies on Resource Context events so it "needs" a container context to run.
    You can use the ControlTestCase to unit test an EJB via EJB Control. You will need to configure the JNDIContextEnv annotation to bind to the server where the EJB is deployed. Note that this only works with EJBs that have a remote interface and a global JNDI name.
    The test case would look something like this (I've seen this example run as long as the JUnit classpath includes weblogic.jar)
    public class SimpleClient extends ControlTestCase {
    public void setUp() throws Exception { super.setUp(); }
    public void tearDown() throws Exception { super.tearDown(); }
    @Control
    @EchoEjbControl.JNDIContextEnv(
    contextFactory="weblogic.jndi.WLInitialContextFactory",
    providerURL="t3://localhost:7001",
    principal="weblogic",
    credentials="weblogic"
    public EchoEjbControl echoEjb;
    public void testXXX() {} // ... test methods that reference echoEjb
    Thanks
    Vimala

  • Web Dynpro to EJB

    Hi all
    I built a small application in Web dynpro which takes an XDP and XML and renders it with a limited set of Reader Rights which works great.. What I trying to do now is to port the code to an EJB with a Web Services so that this can be accessed by other systems..
    When I call my web service i get the following error.. any ideas...
    Regards
    Kev
    Caused by: java.lang.NoClassDefFoundError: com/sap/tc/webdynpro/adsproxy/types/p1/RpData
         at com.sap.tc.webdynpro.pdfobject.api.WDPDFObjectFactory.getPDFObject(WDPDFObjectFactory.java:43)
         at com.adobe.consulting.eon.RenderServiceBean.eonRenderPDFObject(RenderServiceBean.java:154)
         at com.adobe.consulting.eon.RenderServiceLocalLocalObjectImpl0_0.eonRenderPDFObject(RenderServiceLocalLocalObjectImpl0_0.java:103)
         ... 25 more

    Thanks for your reply Charan,
    I am fairly new to EJB. I have created only one session bean (called TrainingBean) and created all the business methods inside it.
    Here is my database schema, with the following 5 tables
    Courses
    CourseSchedules
    Students
    Registrations
    Competencies
    Here are the session bean business methods:
    changeCourse(String)
    changeStartDate(String)
    createCourse()
    createCourseSchedule()
    getCourses()
    getCourseSchedules()
    registerStudent(String)
    unRegisterStudent(String)
    Is this good way to implement EJB, or should I create multiple session beans and multiple corresponding Data access command beans  ?
    Thanks a lot
    Srinivas

Maybe you are looking for

  • Ram issues with FCPX

    I am experiencing an issue where the longer I work in FCPX my RAM is consumed until it shows as a hair-thin slice inside of Activity Monitor, and the performance reflects what I'm seeing in Activity Monitor.  If I close FCPX all my RAM returns and I

  • 9iAS  java functions are not working

    Dear All. I’m using oracle 9iAS Release 9.2.0.1.0 and JServer Release 9.2.0.1.0. I’m using java functions (eg. Array, pop, push method and trim function) in my JavaScript section. But these functions are not working. When run the page it work up to t

  • G5 Dual - DVD Reader has gone very very slow after Leopard

    After 1 Migrate install and 1 clean install, I notice that reinstalling apps is taking 4/5 times as long as they should it's as if my DVD Reader has gone very very slow. I thought at first it was the migration that had caused FCPS2 to reinstall slow.

  • 4 libraries in WindowsOS format

    I imported from 10g/UNIX a database and imported into my 10g/Windows7 computer and i see that following libraries were created: SELECT * FROM All_Libraries WHERE Library_Name IN ('SHA256LIB', 'CRYPTLIB', 'MD5LIB', 'SHA1LIB')      YTIRCES     SHA256LI

  • After i updated firefox --my autofill for my email does not work. i have to enter the complete contact name instead of being completed automatically

    before i upgraded my firefox my email would autofill. now it does not. i have tried to switch back to my previous version but can not seem to do that either