Using application or entity services as model?

Hello,
is it a bad decision to access the CRUD and findBy operations of my entity services with UI patterns?
The book "SAP xApps and the Composite Application Framework" says, only application services should be used to handle with the UI, according to the MVC principles. But in carpool examples also entity services are used. So why should I map the needed entity service operations to application services?
What is the pro and contra?
Thanks and regards
Joschi

Hello Joachim,
I would also add that when the book states that "only application services should be used to handle the UI", the main point is that no business logic should be put in the UI and it should only be put in the application service.  Once business logic is put in the UI, then you can not web service enable this logic.  So in general, all business logic should be put in the Application Service.
If there is no business logic between the UI and the Entity (like in the carpool example), then there is no need to create a redundant application service.  Since it is impossible to put business logic in the CAF UI Patterns, they can always directly call Entity Services without violating this design principle.
Regards,
Austin.

Similar Messages

  • How to use application managed entity manager in EJB?

    I finish reading The EntityManager Interface in JEE tutorial.
    I know I can use container manager entity manager in EJB, but I want to explore how to use application managed entity manager in EJB.
    Can I use application managed entity manager in EJB (container management JTA transaction is used)? Where do I should close entity manager if can?
    The following is an example from JEE tutorial, but didn't find where to calose entity manager. and can I create mutiple EntityManagerFactory objects and Entity Manager objects to use them in a JTA transaction?
    @PersistenceUnit
    EntityManagerFactory emf;
    EntityManager em;
    @Resource
    UserTransaction utx;
    em = emf.createEntityManager();
    try {
      utx.begin();
      em.persist(SomeEntity);
      em.merge(AnotherEntity);
      em.remove(ThirdEntity);
      utx.commit();
    } catch (Exception e) {
      utx.rollback();

    Seems like a very poor example, the whole power of EJBs is to use Container Managed Transactions so you don't NEED to manage the transaction and the entity manager yourself. What you posted is code I would expect in a non-JEE application, or in a piece of code which requires fine-tuned transaction boundaries such as batched data importing logic.
    If I were you I'd research JPA in steps.
    a) learn about JPA as an API outside of the scope of EJBs (recommended reading: the book 'Pro JPA 2')
    b) learn about Container Managed Transactions in EJBs
    c) learn about Bean Managed Transactions in EJBs
    Right now you're rushing into c). I can understand that it raises many question marks at this point.

  • Realationship enterprise service - application/entity service

    I read some books about ESA and CAF but I still don't know the relationship between enterprise services in ESA and application and entity services in the Netweaver DevStudio (CAS framework).
    Are application/entity services also enterprise services? Or is there a difference?
    Thanks for your answers.
    Joachim

    You can consume SAP Enterprise Services. You can also participate in the definition of the Enterprise Services  through the ES Community (see ES Community under Enterprise SOA in SDN) and even create your own Enterprise Services. You can use whatever web development tools you like. In Netweaver Java stack, you can use CAF to implement or develop Application Services (where business logic is coded) leveraging Entity Services taping into your local or remote data model(s). Enterprise Services can be modeled and coded in CAF Application Services but you can use plain J2EE as well. In SAP case, the interfaces for Enterprise Services are defined in XI (input/output/exception). Their implementation happen in the appropriate SAP solutions like ERP where business logic can execute against appropriate data.
    Practically CAF Entity Services cannot be called Enterprise Services unless you want to. They just perform basic CRUD (create/read/update/delete) operations on an data object. They're more like utility services. But like Anton's mention of "Private Enterprise Services", what's private remains your own business!

  • CAF DB Update for CAF Entity Service from Web Dynpro

    Hi all,
    I have created an entity service in CAF called “Contacts’ which contains the following attributes.
    phoneNo
    cellNo
    emailID.
    Another entity service called "Person" is created. This contains the following attributes.
    personId
    personName
    personAddr
    contactsRef. (Cardinality -> 0..n , Relational Type -> Composition)
    That means Contacts entity service is used within Person entity service. Now it is working fine within CAF service browser. Now the Web Dynpro DC of CAF application is used within another custom Web Dynpro DC project. I want to store data from Web Dynpro.
    Within the context of component controller of  Web Dynpro the structure is like
    APerson
         |_ personId
         |_ personName
         |_ personAddr
         |_ contactsRef       
                    |_ phoneNo (Under contactsRef)
                    |_ cellNo (Under contactsRef)
                    |_ emailID (Under contactsRef)
    So I have written the following code within web dynpro custom method.
    APerson person = PersonServiceProxy.create();
    java.util.List ls = new ArrayList();
    for(int i=0; i<4;i++)
    AContacts contact = ContactsServiceProxy.create();
    contact.setCellNo("9092130156");
    contact.setEmailID("[email protected]");
    contact.setPhoneNo("432258");
    contact.getAspect().sendChanges();
    ls.add(contact);
    person.setRelatedModelObjects("contactsRef",ls);
    person.setPersonID("9999");
    person.setPersonName("xyz");
    person.setPersonAddr("ABC, KOL");
    wdContext.nodeAPerson().bind(person);
    person.getAspect().sendChanges();
    CAFServiceFactory.getServiceFacade(idendityDefinition.class);
    After saving the data from Web Dynpro I am trying to test it from CAF service browser. But I am getting only the parent row. I mean only the value of personId, personName and personAddr fields which I have stored from Web Dynpro. But no value is coming within the table for Contacts entity service for composition relation.
    Could anybody help me how can I solve my problem?
    Thanks & Regards
    Chandan
    Message was edited by:
            Chandan Jash

    Hi Chandan,
    Can you do person.getRelatedModelObjects() and get the contact object, to check whether it is null, also check in the CAF DB whether the data you entered is present.
      I am not sure the code is actually adding the contact model object to person.
    Go thru this SDN Blog on usage of the CMI API's, there is a link for CMI documentation in it which might help you get the right code for adding the contact object.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cef4f43e-0d01-0010-db84-ede25c874115.
    award points if  info is helpful
    Regards,
    Anish

  • How to design CAF Entity service?

    hello,
    here is my question.
    how to design CAF Entity service?
    i got employees data and departments data.
    an employee can join over one department, and of course, a department had many employee.
    in tradition RDBMS(relational database management system), i'll create three tables and named "Employee", "Department" and "DepEmp". the table "DepEmp" is a kind of table for N to N relaction.
    but when i use CAF's entity service, i can't do like RDBMS.
    i can create three entity services, named "Employee", "Department" and "DepEmp". i can make service refence(pull service from left side of windows), but the information about Key(in properties) cannot be "true".
    how can i do?
    is there a different normalization way i have to learn.

    thank you so much, it really help.
    but when the issue more complicated.
    a employee can join multiple departments, and he/she got different job title in each department. case will like fallow.
    Vic is a software engineer in XX company's IT department, and he is a MIS engineer in XX company's HR department.
    the db( i'm sorry for take this for example) structure will like..
    =======================================
    table:employee
    column:
    employeeCode PK
    name
    phone
    table:department
    column:
    departmentCode PK
    name
    location
    table:jobTitle
    column:
    titleCode PK
    name
    description
    table:deptEmployee
    column:
    employeeCode PK FK
    departmentCode PK FK
    titleCode PK FK
    =======================================
    my SAP NetWeaver Developer Studio is version 7.0
    1. how i make sure that three keys be mapped each other?(empCode,deptCode,titleCode)
    2. is there have any "IUD abnormality" risk?
    3. if there have, how can i avoid it?
    thank you again, i'm sorry for ask much, because the way to design CAF Entity Service is that i didn't learn before. it really make me confused.
    have a nice day

  • Using different RFC's in one Application / Entity Service?

    Hello *,
    I just want to create my first Composite Application Service but before I begin I have some questions.
    The service will read out material master data from PLM. For that it has some findBy-operations with full-text search (creationDate, MatNr. ...) which return a result list and one operation which returns the material object for a given MatNr.
    For this operations I need to call different RFC's which are imported by external services.
    Now my questions:
    1. What kind of service should wrap my external services and provide the operations? Should I use one or more entity service to wrap external services and then realize the operations in an application service? Or should I just take an application service without entity services?
    2. The created service should not only be an internal CAF  service but also a Web service? How can I realize this?
    Thanks for your answers.
    Best regards
    Joschi

    Ok, thanks a lot. So nearly everything's clear now. Only one question remains:
    > 6. mark the entity service as "remote" and create a
    > web service from it
    > (note: this requires NW04s SP8)
    Is this possible? I can't find any checkbox to mark an entity service as "remote" like in an application service (NWDS 7.0.07 and NW04s SP8).
    So I have to map the findBy operations to an application service and create a web service from it!?
    Regards
    Joschi

  • In application services i am using entity services

    hi all
    i have created application services in entity services i have created findAll ()method that method i have accessed in application services by
    getEntityServices.findAll .and i have made application service as a webservices but when i am testing this method in wsnavigator
    this method gives error.please reply soon
    com.sap.engine.services.webservices.wsnavigator.WSNavigatorException: null
    Exception id: [02004C4F4F50004E000006FA00000E4000042DBF06435C4C]

    Hi, I tested the application using the CAF Runtime Configuration service test and it was an authorization Issue. The entity was set to check permissions. I disabled this in NWDS and it works fine now

  • Access to Entity Service from Portal Application

    Hi Experts,
    I have a hybrid application which will be making use of both Web Dynpro and Portal Applications. I decided to use Entity Services to store my back-end data and can access it fine from the Web Dynpro project. I have included the public part of my CAF project into the Used DCs of my Portal project and while I am able to call the methods of the Entity Service at compile time, at runtime I receive an error message on the page:
    An exception occurred while processing a request
    I know in order to get this to work for Web Dynpro I had to include sap.com/tccolapi.sap.com/cafruntimeuicouplingapilib as a Library Reference and a few Used DCs, but while I have added the Used DCs to the Portal project, I am unsure of how to add the Library Reference. I assume this has to be added to portalapp.xml, but I don't know the syntax.
    Could somehow please reply with how to do this and whether this is all that is required in order to call Entity Service methods from Portal applications?
    Thanks,
    JP

    Hi Smith,
    Write click on the Project then goto the Properties=>Webdynpro References=>Library references
    add
    caf/eu/gp/api
    sap.com/cafruntimeuicouplingapilib
    And add the following DC in your project.
    1> External in caf/eu/gp/api (CAF domain)
    2> caf/eu/gp/api/wd (CAF domain)
    3> com.sap.security.api.sda (SAP-JEE)
    portalapp.xml
    <?xml version="1.0" encoding="utf-8"?>
    <application>
    <application-config>
    <property name="SharingReference" value="usermanagement, knowledgemanagement, landscape, htmlb, exportalJCOclient, exportal, SAPJ2EE::library:cafeugp~api"/>
    </application-config>
    <components/>
    Check this thread .
    Using CAF GP API in Portal Application project
    Regards,
    Mithu

  • How to use a structure in CAF entity service

    Hi All
    I want to use a structure as datatype of a complex attribute in a CAF entity service. I tried to use a dictionary structure created in the dictionary part
    of the CAF project and added it to the public part of this DC.But I can't find it in the list of data structures while trying to mention datatype for a complex attribute in an entity service. Can any body suggest how to do it.
    Cheers
    Sudip

    Hello Sudip,
    You can create a complex structure by doing the following:
    1.  From the Attributes Tab, right click on your Entity and select "Create Attribute"
    -  Enter an attribute name and description
    -  select "Complex Attribute" checkbox
    -  select "Finish"
    2.  Right click on the newly created complex attribute and select "Create Sub Attribute".  Do this for each attribute in your structure.
    This complex structure can now be used in your CAF application and also CAF UI patterns.
    Creating complex attributes from the data dictionary is only usually used for creating enumeration types.  When doing this, you have to use the CAF enumeration editor to populate the values.  The "How to guide" that Jan refers to describes this.
    Regards,
    Austin.

  • How to addRecord in Web Dynpro to Model node (Entity Service ref)

    Hi,
    1) I create Entity Service in CAF and try to write web dynpro Table UI for it.
    2) is it possible with using Model Node? or I MUST use Value Node - Table must have possibilities for Add, Edit and Delete records.
    Now I can edit, and delete records, but I can't add records with AddRecord method
    Code below
      public void NewTS( )
         //@@begin NewTS()
       IServiceFacade serviceFacade;
    // Add new Model object TS
       ATS ts = TSServiceProxy.create();
       ts.setDate( new Date(System.currentTimeMillis()));
       ts.getAspect().sendChanges();
       serviceFacade = CAFServiceFactory.getServiceFacade(tsDefinition.class);
    // try to addRecord to Controller context     
       IWDNodeElement n = wdContext.nodeTS().createElement(ts);
       wdContext.nodeTS().addElement(n);
    The error is: com.sap.caf.rt.exception.CAFBaseRuntimeException:
    Aspect row is invalid for aspect:   <Aspect name="TS" >
    Thx for any help

    Hi Nikolai,
    implement it in the following way:
    wdInit()
         IAspect originalAspect = TSServiceProxy.FindByName(employee) ;
         wdContext.nodeTS().bind(originalAspect)
         //just create new attribute this java native type IAspect
         wdContext.currentContextElement().setOriginalAspect() ;
    public void NewTS( )
    //@@begin NewTS()
         IAspect originalAspect = wdContext.currentContextElement().getOriginalAspect() ;
            IAspectRow newTS = originalAspect.createAspectRow() ;
            newTS.setAttributeValue("date", new Date(System.currentTimeMillis())) ;
    or
    public void NewTS( )
         IAspect originalAspect = wdContext.currentContextElement().getOriginalAspect() ;
            IAspectRow newTS = originalAspect.createAspectRow() ;
         ITSElement tsElem = wdContext.nodeTS().getTSElementAt(originalAspect.indexOf(newTS)) ;
            tsElem.setAttributeValue("date", new Date(System.currentTimeMillis())) ;
    Best regards,
    Aliaksei

  • Problems updating Entity services or application services

    Hello all,
    I'm working with SAP Netweaver Developer Studio creating a new CAF application.
    First all, I import the SAP Entreprise Service, then I model the entity service, I expose my application Service as a Web Service and finally I deploy it and test it.
    However, when I try to edit my entity service (for instance, including a new attribute) or application service (for instance, changing the bussiness logic code) and I redeploy it, the Web Service Navigator doesn't update the changes.
    So, sadly I must start again configuring the entity and application service.
    Any idea??
    Thanks,

    everytime you change the signature (structure of input/output) of the entity or application service, the change is not automatically propagated to the web service definition. you have to delete manually the web service configuration for the entity or application service or recreate it. you can call it a bug or a feature. it's up to you.

  • I recently got a i phone 3 GS, how do I use applications now ? Do I need to buy some apple pack for apple services monthly ??

    I recently got a i phone 3 GS, how do I use applications now ? Do I need to buy some apple pack for apple services monthly ??

    You download apps from the App Store on your iPhone or iTunes from your computer.  If from the computer, you then sync them to your 3GS via iTunes.
    A few helpful links...
    http://www.apple.com/support/itunes/
    http://www.apple.com/support/iphone/
    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • Update Entity Service using Web Dynpro

    Hi,
    I am pretty new to Web Dynpro. I have defined an Entity Service which is working. With Web Dynpro I can create new entities using:
    ASomething newSomething = SomethingServiceProxy.create();
    newSomething.setX(x);
    newSomething.getAspect().sendChanges();
    Now I would like to update this entity and tried:
    ... wdContext.currentSomethingElement().modelOject();
    mySomething.setX(y);
    newSomething.getAspect().sendChanges();
    unfortunately this is not working. The database is not updated. How to solve this problem?
    Thanks in advance!
    Felix

    Hi
    thanks for the answer, but I think you do not have to call serviceFacade.save() and unfortunately it did not help.
    I found a solution, but I think it is more a work around. There should be a better option...
    ASomething something = wdContext.currentSomethingElement().modelOject();
    ASomething something2 = SomethingServiceProxy.read(something.getGuid());
    something2.setX(y);
    something2.getAspect().sendChanges();
    using this coding the DB is updated.
    Why is it not possible to call directly:
    somethin.getAspect().sendChanges()
    Thanks,
    Felix
    Message was edited by:
            Felix Japs

  • Accounts used by application pools or service identities are in the local machine Administrators group.

    I am getting the Warning: "Accounts used by application pools or service identities are in the local machine Administrators
    group."
    Using highly-privileged accounts as application pool or as service identities poses a security risk to the farm, and could allow
    malicious code to execute.  The following services are currently running as accounts in the machine Administrators group: SPUserCodeV4(Windows Service) 
    OSearch14(Windows Service) 
    SPSearch4(Windows Service) 
    WebAnalyticsService(Windows Service) 
    I understand that the users running these Windows Services must not
    be a local administrator of the server. The user I have assigned for the aforementioned Windows Services are in the following Groups in the SharePoint Server:
    IIS_IUSRS
    Performance Monitor Users
    WSS_ADMIN_WPG
    WSS_RESTRICTED_WPG_V4
    WSS_WPG
    Which group must I remove the user from?

    Since I used the same account for all; I am getting the following error message:
    The server farm account should not be used for other services.
     the account used for the SharePoint timer service and the central administration site, is highly privileged and should not
    be used for any other services on any machines in the server farm.  The following services were found to use this account: SharePoint - 80 (Application Pool) 
    SPUserCodeV4(Windows Service) 
    OSearch14(Windows Service) 
    SPSearch4(Windows Service) 
    Web Analytics Data Processing Service(Windows Service) 
    Should I use another non administrator account for farm Administrator?

  • How to use Application Roles with Entity Framework

    How does one call sp_setapprole before a connection used by an Entity Framework object context closes, since the context opens and closes its own connection automatically, as needed? The only relevant event available on a store connection
    (DbConnection ) is StateChange , which does not include a
    ConnectionState of Closing . Attempting to call
    sp_setapprole when ConnectionState is Closed results in, "A severe error occurred on the current command. The results, if any, should be discarded."

    Yes, I realize that I need to call sp_setapprole on an open connection and that I can use
    ExecuteNonQuery or similar mechanisms. What I need to determine is how to do this
    automatically while using the entity framework.
    As I mentioned in my initial inquiry, the EF store connection, which is simply a DbConnection under the covers, does not expose an event (such as Closing) that would allow me to invoke
    sp_setapprole before a connection is closed. The only close event we are given is
    Closed , which is too late to do any good. I'm hoping to avoid burdening our systems with having to manually manage the connection.

Maybe you are looking for

  • Print report on network/local printer

    Hi forms gurus, I repost this topic because it's very important to me.We have at a lot application witch work in client/server mode using forms/Reports 6i.With these applications we haven't problem to print report on printer using RUN_PRODUCT.Now we

  • Mobile device ?

    What is this, i cannot connect my ipad to the computer because anything ....blabla..... Mobile device...  Can anyone help me ?

  • How To Write a Book

    I am a teacher (music) and just bought  Adobe CS4 Premium for my business.  One of my goals is to write/assemble a music book and I plan on using InDesign as my assembly tool  This book has text, photos, charts and diagrams, and lots of music notatio

  • PSA table name not visible in the list

    Dear All, I have been trying to delete the data from the PSA tables using the process type <b>Deletion of Request from PSA</b> and the Object type <b>PSA TABLE</b>. When searching for the PSA table name in the <b>Object Name</b> list, I am not able t

  • LV8: Diagram Disable Structure

    I am converting my test code from the use of traditional DAQ to DAQmx. In a couple of my test VIs I have the Traditional DAQ VI for Port Config. if I put those in a disable structure marked as disabled will it cause any issues when running using DAQm