Initializing Attributes in create() method

We're currently using the BC4J framework within the Struts context. I'm trying to initialize non-constant attributes (e.g., current date) in the create(AttributeList) method of an xxxEntityImpl class, but when I try to commit the transaction, it fails.
I know the problem has to do with the fact that BC4J (within the Struts context, at least) creates an emtpy Entity object when the user selects the "new" link, and uses this entity to populate the entry form, then creates a new entity when the form is posted. (This also causes the wasted sequence value, but we've worked around that issue.) When any attributes are set in the create() method, the first entity is added to the pending transaction because it has changed. However, we only want the second entity (created on form post) in the transaction. Is there any work around for this?
Any help would be much appreciated.
Thanks,
Patrick

You MUST provide an organizatation name. There is a system entity adapter on the Users data object. You cannot avoid populating this.
-Kevin

Similar Messages

  • Setting transaction attributes for EJB Create methods

    Dear developers
    How do I set transaction attributes at the method level. I am able to set this only at the bean level.
    I am trying to use container managed transactions.
    Thanks
    Naveen

    if you specify * in the <method-name> element, then it is the bean
    otherwise, you can specify a particular method name in the <method-name> element.
    Best regards...
    Dear developers
    How do I set transaction attributes at the method
    level. I am able to set this only at the bean level.
    I am trying to use container managed transactions.
    Thanks
    Naveen

  • Multiple create methods of entity beans in single transcation

    Hi,
    I have some entity beans with CMR. I am managing these entity beans with a Stateful session bean whose transaction type is Container Managed for all its methods.
    In one particular method of this Session bean I am calling two entity bean's create method. i.e I am creating two entity beans through home.create() methods. There are two home.create() methods one after another inside a try catch block.
    I want that the entire operation be under just one transcation so i have also given the transaction attribute as Required for all methods of Session bean and Entity Beans.
    However if i pass invalid parameters to second create method so that it generates exception then still the first create statement is successful and database is updated.
    what i want is that the first create also should be roll backed.
    How can i acheive this through Container Managed Transaction Session Bean?

    Hi Ashwini,
    "Ashwini" <[email protected]> wrote in message news:400291af$[email protected]..
    I have some entity beans with CMR. I am managing these entity beans with a Stateful session bean whose transactiontype is Container Managed for all its methods.
    >
    In one particular method of this Session bean I am calling two entity bean's create method. i.e I am creatingtwo entity beans through home.create() methods. There are two home.create() methods one after another inside a try catch
    block.
    >
    I want that the entire operation be under just one transcation so i have also given the transaction attribute asRequired for all methods of Session bean and Entity Beans.
    >
    However if i pass invalid parameters to second create method so that it generates exception then still the firstcreate statement is successful and database is updated.
    what i want is that the first create also should be roll backed.
    How can i acheive this through Container Managed Transaction Session Bean?o Do you use TXDatasource with your entity beans?
    o In CMT transactions are automatically rolled back only when RuntimeExceptions
    are thrown. What kind of exception is thrown in your case?
    Regards,
    Slava Imeshev

  • How to override the create method invoked by a create form?

    Hello everyone, I'm using ADF Faces and have the next question:
    How can I override the create method which is invoked by a create form to preset an attribute in the new row (the preset value is not fixed, I have to send it to the method as a parameter as it is obtained using an EL expression)?
    In the ADF guide I read how to override a declarative method (Section 17.5.1 How to override a declarative method), but this explains how to do it with a method that is called by a button. I don't know how to do the same with a method which is called automatically when the page is loaded.
    I also tried overriding the view object's createRow() method to receive a parameter with the preset values but it didn't work, I believe that was because the declarative create method is not the same as the view object's createRow. This caused the form to display another row from the viewobject and not the newly created one (I also set the new row into STATUS_INITIALIZED after setting the attribute).
    Well, I hope my problem is clear enough for somebody to help me.
    Thank you!

    Hello,
    I'm not sure you can do it with standard generated Create Form.
    In your view object you'll need to create your own create method with parameters, publish it to client interface and invoke instead of standard generated create action in page definition.
    Rado

  • Using ADF View object create method in Data Action

    I need to know how to create a new row in an application module method and get the attributes from the ADF input form.
    If i Drag drop the create method in the data action form it is working fine. But how to do this programmatically, I have a need where i need to execute a query on another view object and set the create method.
    Thanks.

    Steven:
    (My application does not need to show all records and provide Edit/ Remove buttons at row level, navgational buttons and Create button for inserting new record. Instead, I would just open a blank record for entry, and commit)
    As per your post, I followed the following steps (action class) to insert blank record:
    DCBindingContainer bindings = actionContext.getBindingContainer();
    DCControlBinding binding = bindings.findCtrlBinding("Id");
    Row row = binding.getRowIterator().createRow();
    row.setNewRowState(row.STATUS_INITIALIZED);
    RowSetIterator rs =(RowSetIterator)
    binding.getRowIterator();
    rs.insertRow(row);
    End Results: It works fine and a new blank record is created. The only problem is <html:errors/> in JSP throws error for the first time. I do not want to elliminate error object from JSP.
    Please help!
    Thanks in advance

  • Calling a css user created method from jspx page in ADF faces

    Hi all,
    Can anyone help me out to solve an issue calling a css user created method from a jspx page.
    Note: The css method is not the default css method. It needs to be called using 'styleClass' attribute in any tag.
    Thanks
    Neha

    Hi,
    I am not an expert in CSS so I don't know what a css method is. However, CSS can be applied to components via EL accessing a managed bean that returns the sytle text
    Frank

  • Complex data type to application service create method(CRUD)(Urgent)

    Hi Experts,
    I have created an entity service with remote persistency(Web service).i am mapping the entity service CRUD methodes to web service methodes and i am calling these CRUD methodes form the corresponding applicaion service CRUD methodes.With out complex data types both sevices are working  fine.I have tested them in the service browser.
    Later I have created a complex data type in the entity service and mapped it to web service.But when i am creating the application service create(CRUD) method for this entity service the complex data type which i have created in the entity service is not being shown as possible input attributes of the application service create method.Due to this i am not able to pass this complex attribute form the application service create method to the entity service create method.
    Plz tell me how can i resilve this issue.(Urgent)
    Thanks
    Sampath.G

    Hi Sampath,
    Please check SAP note 1004108. I think the issue you describe is one of the limitations described in this note.
    Regards,
       Jan

  • How to access Business object type attribute from a method/function modul ?

    Hello,
    i have created a business object type object along with attributes and methods. Now inside the method i want to access the attributes. inside the method i am writing:
    data a type XXX.
    a = me->attribute
    this is creating a compilation error.
    Now the method is defined as a function module in some package, so can anyone inform me how to access object attributes from the function module ?
    pointes are awarded
    Regards

    Hello,
    thanks for your answer, but this too did not work, "=>" is for static attributes and the attributes i have are not static. Moreover, i tried it but it gave the same error :
    the abap error was when i was checking the code is :
    the type me=>documenttype is unknown
    as you know in SWO1 i created an object and when i create a method you link it to a function module and this is where you have the implementation of the method, so from this method how can i access the attributes on the main object that i created in SWO1
    regards

  • AC 5.3 - CUP - initiator attributes - conditional logic

    Is there a trick to making the conditional logic work correctly in CUP when trying to define/select the initiator attributes?   Even when I specify to use AND, it seems to still be adding the attribute with an OR condition.
    For our non-production provisioning,  I have a role that needs to be approved by different people depending on which system (i.e. Dev, IT, QA) it is being requested.  I am trying to set up the 2 initiators as follows:
    Initiator 1:  Application/System = DEV and  Role = Role 1
    Initiator 2:  Application/System = IT or QA    and    Role = Role1
    Edited by: Jane Yap on Oct 22, 2009 5:12 PM

    After playing around with this more,  it appears that if I am selecting Role as the attribute and use the search functionality (i.e. click on the magnifying glass) to specify/select the actual role/role name,  the conditional logic does not get set accordingly.   In order to get the correct conditional logic set (i.e. populate the one I actually selected),  I need to type the role name or pattern of the role name instead of selecting the role using the search functionality.  
    I guess everywhere else within GRC AC it's always best to use the seach functionality when setting/selecting field values  (as opposed to manually typing/entering the values) EXCEPT for when creating/changing CUP initiators.   Documented feature? Perhaps...
    Thank you to those who responded to my post.

  • Defaulting logic in entity create method

    Hi
    As suggested by BC4J I use the create method of my entity object to insert defaulting logic for some attributes. The code looks like this:
    protected void create(AttributeList attributeList)
    super.create(attributeList);
    Number seqNumber = new Number();
    SequenceImpl s = new SequenceImpl("REV_SEQ", getDBTransaction());
    seqNumber = s.getSequenceNumber();
    setRevId(seqNumber);
    setCreationDate(SamUtils.getSystemDate());
    ApplicationModule am = getDBTransaction().getRootApplicationModule();
    if (am instanceof SecuredApplicationModule)
    setUsrId(((MyApplicationModule) am).getUsrId());
    But executing this code results in an Exception: "JBO-25014: Other User has changed the Row". If I remove the code between the lines above everything works ok.
    My questions are:
    - Is it ok to use set-Methods in the entity create method? Or should I set my default values to the "attributeList" instead?
    - do you think it is a problem to use the ApplicationModule as shown? I should mention that am.getUsrId() simply returns a previously stored variable and does not perform any queries or alike.
    Thanks for your help
    Frank Brandstetter

    It's definitely fine to setAttributes - I've done it myself (but not using "specific" setters).
    I haven't used the built-insequences before - this bit of your code looks a bit wasteful in terms of object creation, but that's obviously not your issue....
    It looks fine to use an application module in such a way; I coded a "current user id" function on mine too.
    I actually suspect the date-attribute, since I (me again!) had some "concurrent user" problems too. The issue was the fact that a Java date is accurate to the millisecond, and the database storage and retrieval wasn't. (I wasn't using Oracle so I'm not sure how it goes there....) A "concurrent user" exception gets thrown when bc4j goes to update an entity and finds that the date-value in the object doesn't match the "rounded" one it retrieves (as a check, just before it does the update - this is the optimistic locking) from the database. [So does the error occur only when you've saved the new entity once, then update it and try to save it again?]
    I got around it by setting the millisecond portion of any dates I used to zero (since the "storage" was accurate to a second) - so you might try that. (Did it generically in prepareForDML in my own Entity superclass, I think.)
    Otherwise, try setting the attribute, but not in the create method, and seeing if you get the same problem...
    HTH
    Mike.

  • BC4J with Struts using EditAction's create method.

    Hi,
    I am using BC4J with struts and using the EditAction and UpdateAction classes provided by BC4J.
    When i want to create a new row in the database the documentation asks me to call EditAction's create() method and then UpdateAction's execute() method to do it. But even when i just call UpdateAction's execute() method I am able to create a new row. So WHY should I call EditAction's create() method ?????

    EditAction's create() method is something you would call in the action before rendering the empty form for the user to fill in.
    It creates a row, and then marks the row as having STATUS_INITIALIZED using the Row.setNewRowState(Row.STATUS_INITIALIZED) call.
    By setting the row to STATUS_INITIALIZED, this makes BC4J "forget" that it's a new row that needs to be inserted. In effect, it makes that new row a throwaway row used only for the purpose of rendering the blank form. An important reason you would want to do things this way is to pickup entity-level default values in the attributes of the new row.
    For example, in the toy store demo, why is it that when you register as a new user the "Country" poplist defaults to "United States" ? (it's not the first entry in the list).
    The answer is that, since the EditAction (or in this case my custom subclass of that) creates the blank row, the fact that the "toystore.model.businessobjects.Account" entity object declares that its Country attribute has a default value of "US" makes the blank row created in the "toystore.model.dataaccess.Accounts" view object have a default value of "US", and that default value in the blank row causes the <jbo:InputSelect> tag that renders the poplist to mark the corresponding "United States" option in the list as currently selected (as it's the display string associated in the poplist with the value "US").

  • Sequence in Impl create() method + UIX

    I am populating a key from a database sequence from
    the entity ???Impl create() method. It tests out OK from
    the tester and any generated browse and edit forms except the UIXML. I can see it being called twice from a UIXML browse and edit form; once to create the row before the page is rendered and then again during the 'apply' event.
    It ends up wasting every other sequence number. Any ideas on how to stop this?
    * Add attribute defaulting logic in this method.
    protected void create(AttributeList attributeList) {
    super.create(attributeList);
    SequenceImpl seq =
    new SequenceImpl("REGION_SEQ", getDBTransaction());
    Number sval = seq.getSequenceNumber();
    setRegionId(sval);
    System.out.println("create: sval " + sval);
    }

    I believe that the technique that is described by Steve Muench in that article leaves one problem area open. Using the DBSequence domain requires that a trigger be on the database to create the sequence number for the new record. If you need to know what that sequence number is immediately after it was created you will need to do some extra coding to identify it.
    I am not sure what you mean that you would use doDML(). Can you explain further?
    Still, the technique that uses create(), that is also published in the Oracle9i JDeveloper Handbook, should work. I believe that Oracle has recognized this as a bug and plans to have it fixed in the next release.

  • Where to create Methods of Biz Obj in BAPI

    where to create Methods of Biz Obj in BAPI rather than FM,
    points will be rewarded
    thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Hi Jagrut,
    BAPI stands for Business Application Programming Interface.
    <b>There are 5 different steps in BAPI.
    - Create BAPI Structure  
    - Create BAPI Function Module or API Method.  
    - Create BAPI object  
    - Release BAPI Function Module.  
    - Release BAPI object.</b>    
    Step1. Creating BAPI Structure:  
    - Go to <SE11>. 
    - Select Data Type & Enter a name. 
    - Click on Create.
    - Note: Always BAPI should be in a development class with request number (Not Local Object).
    - Select Structure & hit ENTER.
    - Enter the fields from your database. Make sure that the first field is the Primary Key Field.
    - Then SAVE & ACTIVATE.
    Step 2. Creating BAPI module: 
    - Enter TR.CODE <SE37>.
    - Before entering any thing, from the present screen that you are in, select the menu
       Goto -> Function Groups -> Create Group.
       Enter a name (Note: This name Must start with ZBAPI)
       Let this screen be as it is and open another window and there, enter TR.CODE <SE80).
       Click on the Third ICON that says Inactive Objects. 
       Select the group that you just created and click on Activate. 
       Notice that the group you created will disappear from the list of inactive objects.
    - Go back to <SE37> screen and enter a name and hit <ENTER>. Then enter the group name that you just created and activated.
    NOTE: When you release a function module the respective group will be attached to that particular application. It cannot be used for any other application. NEVER include an already existing group that is attached to another module.
    Now click on the first Tab that says [ATTRIBUTES] and select the radio button that says remote-enabled module since we will be accessing this from any external system.
    Then click on the second tab that says [IMPORT].
    Enter a PARAMETER NAME, TYPE and the structure you created in the first step. Also select the check box ‘Pa’. All remotely enabled functional modules MUST be Pa enabled, where Pa means ‘Passed by Value’ and if you don’t select ‘Pa’, then that means it will be passed by reference..
    Then click on tab that says [EXPORT].
    Enter the following as is in the first three fields 
      RETURN        TYPE        BAPIRETURN (These 3 field values are always same)
      Here also select ‘Pa’ meaning Pass by value.
    Note: BAPIRETURN contains structure with message fields.
    Then SAVE and ACTIVATE.
    Step 3. Creating BAPI object: 
    - Enter Tr.Code <SWO1>   (Note. It is letter ‘O’ and not Zero).
    - Enter a name and then click on create. Enter details. 
    NOTE: Make sure that that Object Type and Program name are SAME.   
    - Enter Application ‘M’, if you are using standard table Mara. If you are using your own database then select ‘Z’ at the bottom. 
    - Then hit <ENTER>. 
    - Now we have to add ‘Methods’. High light METHODS and then select the following from the menu: 
    Goto Utilities -> API Methods -> Add Methods.
    - Enter function Module name and hit <ENTER>.
    - Select the second FORWARD ARROW button (>)to go to next step. 
    - Check if every thing looks ok and again click on FORWARD ARROW button (>).
    - Then select ‘YES’ and click on <SAVE>.
    -  Now on a different screen goto TR.CODE <SE37>.  Enter Function Module name and select from the top menu  Function Module -> Release -> Release.
    - Goback to TR.CODE <SWO1>.
    Here select the menu combination shown below in the same order.
    - Edit -> Change Release Status -> Object Type Component -> To Implemented.
    - Edit -> Change Release Status -> Object Type Component -> To Released.
    - Edit -> Change Release Status -> Object Type -> To Implemented.
    - Edit -> Change Release Status -> Object Type -> To Released.
    - Then click on <SAVE>.
    - Then click on Generate Button (4th button from left hand side looks like spinning wheel).
    - Then Click on the button that says ‘PROGRAM’ to see the source code.
    To check if this is present in work flow goto TR.CODE <BAPI>. 
    Here it shows business object repository.
    - First click on the middle button and then select “ALL” and hit ENTER.
    - Goto tab [ALPHABETICAL] and look for the object that you created. This shows that the BAPI object has been created successfully.
    <b>reward pts if found usefull:)</b>
    Regards
    Sathish

  • Create method call

    this.getDepartmentsLocalHome().create
    (dept.getDepartmentId(), dept.getDepartmentName());
    (the example from: http://www.oracle.com/technology/obe/obe_as_1012/j2ee/develop/endtoend/defaultejbscope/defaultejb.htm#t4)
    does the create method called like that allow to insert a new record with all its attributs setted in the controller layer?? or should i define a new create which takes all the attributes as parameters?
    thank u!

    it s the first time i develop with EJB technology.
    i dont know how to use the create method.
    i m trying the following code to add a new row in myObject table:
    public void addMyObject(MyObjectLocalDTO parametre)
    try
    MyObjectDTO obj = this.getMyObjectLocalHome().create();
    obj.setAttr1(parametre.getAttr1());
    obj.setAttr2(parametre.getAttr2());
    obj.setAttr3(parametre.getAttr3());
    obj.setRelationship_idmyobjectDTO(parametre.getRelationship_idmyobjectDTO());
    catch (NamingException e)
    System.out.println(e.toString());
    throw new javax.ejb.EJBException(e);
    catch (CreateException e)
    System.out.println(e.toString());
    throw new javax.ejb.EJBException(e);
    is that correct and enaugh to insert my row? or is there a better way to do that?
    thank u.
    regards

  • Help! MBeanCreationException: Unable to create bean...missing create method

    I am trying to configure an authentication provider with ant using the wlconfig task. This has been working fine until recently and I have no idea what could be wrong. The ant script has not changed and I'm not sure what information to post to be more useful. Hopefully someone has had this problem or can point me in the right direction.
    Below is the target I'm trying to run. I fails with the following exception. I am able to configure the provider manually through the console, however, but this is not an option for our deployments:
    Caused by: weblogic.management.MBeanCreationException: Unable to create new bean of type com.xxx.MyAuthenticator for myDomain:Name=myDomain,Type=Domain:missing create method
    Caused by: java.lang.NoSuchMethodException: MyAuthenticator(java.lang.String,)
         <target name="configure-auth-provider">
              <echo message="Configuring Security Auth Provider..."/>
              <taskdef name="wlconfig" classname="weblogic.ant.taskdefs.management.WLConfig" classpath="${weblogic.jar}"/>
              <wlconfig url="t3://${weblogic.host}:${weblogic.listen.port}" username="${weblogic.username}" password="${weblogic.password}">
                   <create type="com.xxx.MyAuthenticator" domain="Security" name="MyAuthenticator" property="MyAuthenticator">
                        <set attribute="ControlFlag" value="OPTIONAL"/>
                   </create>
                   <query type="weblogic.management.security.Realm" domain="Security" name="MyCustomRealm">
                        <set attribute="AuthenticationProviders" value="MyAuthenticator"/>
                   </query>
              </wlconfig>
              <echo message="Security Auth Provider configured Successfully."/>
         </target>

    Hi Balaji,
    LSMW using IDOC is similar to using flat file method. Here you are getting data from IDOC container and mapping data with Idoc segments insted of flatfile column.
    Hope this is what you are looking for. If helpful then don’t forget to reward me for that
    Darshan

Maybe you are looking for

  • When I open firefox the address bar remains blank after a website is loaded from favorites.

    I open Firefox and the open window is blank (as it should be, because I have set my Preferences to open firefox with a blank window. Then I select a Bookmarked website from my Bookmarks Toolbar, which opens then opens that website in the window fine.

  • Creating billing after MIRO in third party sales

    HI Gurus, we have a senario in Third party sales senario how to restrict the user to make to delivery and billing  before the MIGO and MIRO. please help us this is urgent. Thanks in Advance.

  • Package/Class/Function Problem

    From the Getting Started Lessons in Flex Builder 2, one thing I am trying to learn (but failing) is how to use the TimerEvent class. The sample uses the following code: package import flash.display.Sprite; import flash.events.TimerEvent import flash.

  • Streaming Netflix on our Samsung tv.

    We were sold a Samsung wireless LAN adapter by a Best Buy associate which we were told would allow us to stream Netflix on our UN46C6300SF LED tv. When we tried we were unsuccessful. We chatted with Samsung support and were told that we couldn't stre

  • Migration Process.......

    Hi Folks, I don't aware of migration process(i.e BPC 7.5 NW version to BPC 10.0 NW Version), can please any one let me know how the migration process starts, what are the mandatory steps for migration and all those things. In which note the entire Mi