Setting dynamic values to entity object

Is there any way to set bean values (dynamic values) to Entity Object while commit the record, and how can i set these values using Groovy language
Thanks in advance

You need to give more information about the version of Jdev you use and your use case. read more -
https://forums.oracle.com/forums/ann.jspa?annID=56

Similar Messages

  • Problem while setting new value to entity object attribute in doDML meathod

    Hi all,
    I am overriding the entity objects doDML method for generating the value of Sequence Number just before insert .
    For this puropose i am using doDML method. I am fetching the maximum value for the sequence number feild from the table by a prepared statement
    and then incrementing that value by one.
        protected void doDML(int operation, TransactionEvent e) {
            if (operation == DML_INSERT) {
                // code for getting the max+1 of sequence number before insert
                //command executes.
                try {
                    System.out.println("Inside doDML Method");
                    String sql =
                        "select nvl(max(seq_no),0)+1  from WF_LEAVE_HDR where org_unit_code = " +
                        this.getOrgUnitCode();
                    PreparedStatement pstmt =
                        getDBTransaction().createPreparedStatement(sql, 0);
                    ResultSet rs = pstmt.executeQuery();
                    rs.next();
                    Integer newSeqNo =rs.getInt(1); //(Number)rs.getString(0);
                    //this.setSeqNo(new Number(newSeqNo));
                    setAttributeInternal("SeqNo",new Number(newSeqNo));
                    System.out.println("Value of new seq no is -->>"+getSeqNo());
                } catch (Exception excpt) {
                    System.out.println("Inside catch block ");
                    excpt.printStackTrace();
            super.doDML(operation, e);
        }i am getting the value correct by using the sql statement but while i am using setAttributeInternal("SeqNo",new Number(newSeqNo));
    it is giving an error and value for new sequence no is not passed to the seq no feild of the entity object. I have tried this.setSeqNo(new Number(newSeqNo))
    but it is also not wotrking .
    Any one please help , I am using Jdeveloper 10.1.3
    Thanks all in advance.

    iloveoracle,
    Sigh... in addition to doing this in doDML (which Dimitar points out is the wrong place to do this)... you are making a huge huge mistake.
    select nvl(max(seq_no),0)+1  from WF_LEAVE_HDRWhat happens when two people do this at around the same time? You don't do any locking, so you will get two rows with the same SeqNo. This is absolutely the wrong way of doing sequence numbers. The best way of doing this would be to use real sequence numbers (an Oracle sequence) and ignore the fact that there will be gaps. If you insist on using your approach, you MUST LOCK THE ENTIRE TABLE before you try to do your little max() + 1 trick, otherwise you run the very real risk of getting duplicate SeqNos. OK, I see that you are trying to do sequences by org_unit_code, so you don't have to lock the whole table, but you do have to have some way of holding a lock. You must also write some code to be able to handle an "unable to get the lock because someone else already holds it" type of situation.
    <rant>
    I have seen so many people try to do this little max() + 1 trick. It DOES NOT, WILL NOT work until you handle locking properly. One question that I often ask when I interview database developers is about generating "gapless" sequences; unless the job is for a brand-new-with-absolutely-no-experience trainee, answering "select max() + 1" without any mention of concurrency issues would be grounds for an immediate rejection of the candidate. Seriously. Have a run over to http://asktom.oracle.com and search for "gapless" if you'd like to see a more strongly worded rant.
    </rant>
    Bottom line, just use an Oracle sequence if it's at all possible; otherwise, be prepared to write some bunches of code to deal with locking.
    John

  • How to set Dynamic value to context variable

    hi all
    Can anyone suggest me how to change value of context variable.
    In short i need to set dynamic value to context variable
    here is my code in web.xml
    *<context-param>*
    *<param-name>sessionTimeOutValue</param-name>*
    *<param-value>200</param-value>*
    *</context-param>*

    ChintanPatel wrote:
    here is my code in web.xml
    *<context-param>*
    *<param-name>sessionTimeOutValue</param-name>*
    *<param-value>200</param-value>*
    *</context-param>*You can set the session time using httpsession.setmaxinactiveinterval

  • Problem to give default value in entity object using query

    hi,
    i have one entity object and i want to set default value of attribute like division which is based on employee code.
    entity object based on table leavedetail and using refrence table employee_hdr(empcode ,division).
    so how can i set default value of division attribute which is based on empcode attribute using SQL

    well,
    yes user, fetish nailed correctly.
    make some viewlink.
    something like says as example.
    department vo
    employee vo
    make viewlinks between those vo's
    important thing: exposed then source and destination accesor.
    use groovy :
    go to employee vo - create Department name field ( as transiest)
    use this statement default value expersion type.
    DepartmentView1.DepartmentName
    it will get the value. check over.
    so this example well suits to your scenario.
    i hope this will helps you.
    well create is an video. to get the value using groovy.
    http://www.youtube.com/watch?v=mpHV4x89a_A
    Edited by: ADF7 on Apr 14, 2012 5:46 AM

  • Default value in Entity Object for SYSDATE   ??

    hi ,
    I have a database table which has a DATE column and default value for this column is SYSDATE.
    I want to set default value for this attribute in my EO as I am doing for all other attributes .
    What will be the value of Default Property of entity Object for SYSDATE ??
    Thanx,
    Prasoon

    Hi,
    I succesfully implemented a default systimestamp value.
    I suppose that the same implies for a default sysdate.
    In the DB:
    t_created TIMESTAMP default systimestamp NOT NULL
    In the Entity Object:
    Attribute: TCreated
    Type: Timestamp => in your case Date
    Persistent: yes
    Updateable: never
    Refresh: after insert
    Database column: T_CREATED type TIMESTAMP => in your case DATE
    You could have problems if you leave access to the attribute (updateable flag != never), in this case I suppose the framework adds the Field in the sql insert statement and that would overwrite the default value definition.
    Regards
    Fred
    PS I'm not from Oracle

  • Can af:selectOneRadio initial selection be set to values from view object?

    Using JDeveloper 11.1.1.4
    Hi all. I have a selectOneRadio on a data entry page which works well. Now I want to (if possible) use the selectOneRadio on an edit page--setting the choice initially to the values that were stored in a database table's record (from the data entry page). I am able to retrieve the data selected in the data entry page, but I can't find anything referencing what I want to do on the edit page. Note that my selectOneRadio objects are actually on jsff's in a region on a page. I've supplied how I designed selectOneRadio on the data entry page in hopes that someone can gleen from it and tell me how to set one up on the edit page and set its initial value to the value combination stored.
    There are two columns in the data displayed (example):
    Short Format / Text
    Short Format / Comma Delimited
    Long Format / Text
            <af:selectOneRadio value="#{bindings.Pay_File_Data_FmtVO1.inputValue}"
                               shortDesc="#{bindings.Pay_File_Data_FmtVO1.hints.tooltip}" id="sor1"
                               inlineStyle="text-align:left; font-size:2.0em;"
                               autoSubmit="true" showRequired="false" label="File Format">
              <f:selectItems value="#{bindings.Pay_File_Data_FmtVO1.items}" id="si111"/>
            </af:selectOneRadio>
    public class FileTypesBean {
        String fileFormat = null;
        String dataFormat = null;
        public BindingContainer getBindings() {
            return BindingContext.getCurrent().getCurrentBindingsEntry();
        public void getFileTypesSelection(ActionEvent actionEvent) {
            fileFormat =
                    (String)resolveExpression("#{bindings.Pay_File_Data_FmtVO1.attributeValue}");
            dataFormat =
                    (String)resolveExpression("#{bindings.Pay_File_Data_FmtVO1.attributeValues[1]}");
            //System.out.println("dataFormat = " + dataFormat);
            // now put in ParamsBean for use
            AdfFacesContext afci = AdfFacesContext.getCurrentInstance();
            ParamsBean params =(ParamsBean)afci.getPageFlowScope().get("paramsBean") ;
            params.setFileTypeParam(fileFormat);
            params.setFileDataTypeParam(dataFormat);
        public Object resolveExpression(String el) {
            FacesContext facesContext = FacesContext.getCurrentInstance();
            ELContext elContext = facesContext.getELContext();
            ExpressionFactory expressionFactory =
                facesContext.getApplication().getExpressionFactory();
            ValueExpression valueExp =
                expressionFactory.createValueExpression(elContext, el,
                                                        Object.class);
            return valueExp.getValue(elContext);
    }Thanks in advance,
    Troy
    Edited by: Hoopestr on Apr 18, 2012 10:54 AM

    in the amimpl have an edit method, get the value you want to set and set that value for your af:selectOneRadio, row.setAttribute(PayFileDataFmtVO1, value);

  • How can I set a value to an Object Array

    I am declaring an object variable like this:
    final Object[][] data = {
    {"Mary", new Integer(5)},
    {"Alison", new Integer(3)},
    {"Kathy", new Integer(2)},
    {"Sharon", new Integer(20)},
    {"Angela", new Integer(4)}
    And I would like to declare it like this:
    final Object[][] data = new Object [6][3];
    But the matter is that when I try to set a value like this:
              data[0][0] = "Hola";
    I got the next Errors.
    TableEditDemo.java:95: ']' expected
              data[r][c] = "Hola";
    ^
    TableEditDemo.java:95: <identifier> expected
              data[r][c] = "Hola";
    ^
    TableEditDemo.java:95: cannot resolve symbol
    symbol : class data
    location: class TableEditDemo.MyTableModel
              data[r][c] = "Hola";
    ^
    3 errors
    Could Somebody Help me please???? Thank you very much.

    I don't see problem for your declaration. Is it possible you forgot to cast data back to whatever class?
    PC

  • Dynamic Creation of Entity Objects (ADF Business Components)

    Hi All,
    We have a requirement to create Entity Objects for the dynamically generated tables in our application and at the same time bind them to different views.
    Our product create multiple tables at runtime with some sort of naming convention, and we couldn't find a way in JDeveloper to generate entity objects for the tables created dynamically.
    Please provide some pointers if you have experienced or worked on similar requirement.
    Thanks,
    Nikhilesh

    Thanks for the help Sudipto.
    The link which you have shared, describes the creation of an entity object and then modify the operations like Delete Update and Insert etc to be performed on the entity object by creating IMPL classes and implementing certain interfaces.
    But I need to create Entity objects dynamically. My application creates new tables for some functionality at the run time and I have to create Entity objects for those new tables as soon as the new tables are created.
    I was just wondering if, there is any API available for creating the entity object from Java code instead of invoking the wizard in the Jdeveloper.

  • Set the value of a object in request scope

    I have the object in my req scope. I need to set value to one of the object attributes if that attribute is blank. How can I set its value.
    <c:set var="benefitVO" value="${requestScope.BenefitVO}" />I need to set the following Object attribute value, if it is blank.
    something like --- > benefitVO.setBnftCd("asdf");
    How can I set it using JSTL tags?
    any ideas
    Thanks

    I need to set value to one of the object attributes if that attribute is blank.This is some kind of a default value that you want, then? If so then just take care of that when you output it. Use <c:if>, and if the attribute is blank then output the default value, otherwise output the attribute.
    Or have the servlet that created that request attribute take care of that requirement.

  • Settinc control hints values in entity object attributes generically

    Hi, how are you? I work for a project , that uses JDeveloper 10.1.3.3 version and I am assigned to solve some problems in the part that is associated with ADF Business Components—Model—of the application. The question is how could I implement generic functionality in CustomEntityImpl and there I am to assign some control hint values to some attributes and then the entities that will extend this class will acquire this functionality in their attributes.
    I send you some code I have in my mind in order to find out how to write something relevant to set control hints. I have searched in relevant api’s for AttributeHints and EntityDef but I did not find a solution to my problem. I’ve tried this code:
    private final String desc = "Description";
    protected boolean findAttribute(String name) {
    String[] list = this.getAttributeNames();
    for (int i = 0; i < list.length; i++) {                       
    if (name.equals(list))
    return true;
    return false;
    public void beforeCommit(TransactionEvent transactionEvent) {             
    if (findAttribute(desc)){                                                                   
    * AttributeDefImpl adi=null;
    adi.setProperty(AttributeHints.ATTRIBUTE_DISPLAY_HINT_HIDE,"Hide");
    AttributeDef desc=(AttributeDef)adi.getProperty(AttributeHints.ATTRIBUTE_DISPLAY_HINT_HIDE);
    super.beforeCommit(transactionEvent);
    but it does not work. How could I set this value – to hide one attribute whenever it exists in my entities , setting it once in my CustomEntityImpl class?
    I’ve read the whole tutorial ADF Business Components For Forms 4GL Developers but I did not find a solution to my problem. Your help would be a gift to me. Thank you very much!
    * I think that the error is here because this object can not be null. In an api I found the following :
    Advanced users can provide their own implementation of EntityDefImpl (by subclassing EntityDefImpl). Within it, they can create their own AttributeDefImpls by using: new AttributeDefImpl(...);
    How should I subclass EntityDefImpl to create an AttributeDefImpl object?

    Hi
    why don't you create a mehod on the ApplicationModule and call it from the managed bean (using ADF bindings) to pass ths values in ? Note that a managed bean that has a scope of session doesn't mean that it sits in the session to be shared with ADF BC
    Frank

  • Trying to set control hints in entity object attributes in generic classes

    Hi, how are you? I work for a project , that uses JDeveloper 10.1.3.3 version and I am assigned to solve some problems in the part that is associated with ADF Business Components—Model—of the application. The question is how could I implement generic functionality in CustomEntityImpl and there I am to assign some control hint values to some attributes and then the entities that will extend this class will acquire this functionality in their attributes.
    I send you some code I have in my mind in order to find out how to write something relevant to set control hints. I have searched in relevant api’s for AttributeHints and EntityDef but I did not find a solution to my problem. I’ve tried this code:
    AttributeHints ah=new AttributeHints(new AttributeDef(RIBUTE_DISPLAY_HINT_HIDE ) );
    but it does not work. How could I set this value – to hide one attribute whenever it exists in my entities , setting it once in my CustomEntityImpl class?
    I’ve read the whole tutorial ADF Business Components For Forms 4GL Developers but I did not find a solution to my problem. Your help would be a gift to me. Thank you very much!
    private String primary_key = "Id";
    private final String dte_insert = "Dteinsert";
    private final String dte_update = "Dteupdate";
    private final String user_insert = "Usrinsert";
    private final String user_update = "Usrupdate";
    private final String afm = "Afm";
    protected boolean findAttribute(String name) {
    String[] list = this.getAttributeNames();
    for (int i = 0; i < list.length; i++) {                       
    if (name.equals(list))
    return true;
    return false;
    protected void doDML(int operation, TransactionEvent transactionEvent) {
    //Insert Operation
    if (operation == DML_INSERT) {
    //Add history column
    if (findAttribute(dte_insert)) {
    Date date = new Date((new Date()).getCurrentDate());
    this.setAttribute(dte_insert, date);
    //Update Operation
    else if (operation == DML_UPDATE) {
    //Add history column
    if (findAttribute(dte_update)) {
    Date date = new Date((new Date()).getCurrentDate());
    this.setAttribute(dte_update, date);
    //Delete Operation
    else if (operation == DML_DELETE) {
    //To DO
    super.doDML(operation, transactionEvent);

    I Suggest you set its Attribute on EOImpl, override doDML, and before call super.doDML set your Attribute. There is a special reason to set Attribute on beforeCommit?
    Best Regards

  • Unable to set new values in Entity

    Hi Experts,
    I am trying to change an entity from readonly to changeable and set property of an attribute. But, i am not successful. In the below "If ME->IS_CHAN......" condition, the second condition is not successful and it doesnot let the entity to change. I am not sure, from where the data is getting filled for "ME->CONTAINER_PROXY->DATA_REF->ATTRIBUTE_REF". Can someone please point me the solution ?
    Thanks in advance.
    method IF_BOL_BO_PROPERTY_ACCESS~SET_PROPERTY .
      data: LV_IDX       type CRMT_IDX,
            LV_PROPS_OBJ type ref to IF_GENIL_OBJ_ATTR_PROPERTIES.
      field-symbols: <DATA>  type any,
                     <VALUE> type any.
      MAKE_VALID_STATE( ).
      assign ME->CONTAINER_PROXY->DATA_REF->ATTRIBUTE_REF->* to <DATA>.
      assign component IV_ATTR_NAME of structure <DATA> to <VALUE>.
      if SY-SUBRC = 0.
    *   check changeability of property
        LV_PROPS_OBJ = ME->CONTAINER_PROXY->GET_ATTR_PROPS_OBJ( ).
        try.
            LV_IDX = OBJECT_MODEL->GET_ATTR_IDX_BY_NAME(
                                 IV_OBJECT_NAME = ME->MY_INSTANCE_KEY->OBJECT_NAME
                                 IV_ATTR_NAME   = IV_ATTR_NAME ).
            if ME->IS_CHANGEABLE( ) = ABAP_TRUE and
               LV_PROPS_OBJ->GET_PROPERTY_BY_IDX( LV_IDX ) ne IF_GENIL_OBJ_ATTR_PROPERTIES=>READ_ONLY.
              if <VALUE> ne IV_VALUE.
                if ME->MY_MANAGER_ENTRY->DELTA_FLAG is initial.
    *             first 'change' -> proof that entity is locked
                  if ME->MY_MANAGER_ENTRY->LOCKED = FALSE.
                    if ME->LOCK( ) = FALSE.
                      return.
                    endif.
                  endif.
    Edited by: Gaurav Subramaniam on Jun 2, 2011 5:30 PM
    Edited by: Gaurav Subramaniam on Jun 2, 2011 5:31 PM

    Hi Gaurav,
    As already mentioned your entity is set to READ-ONLY mode at GenIL level. Hence, the following line returns READ-ONLY :-
    LV_PROPS_OBJ->GET_PROPERTY_BY_IDX( LV_IDX ) ne IF_GENIL_OBJ_ATTR_PROPERTIES=>READ_ONLY.
    This is set at GenIL level in the GenIL class. Hence, you'll have to find the GenIL class and look for method - SET_ATTR_PROPERTIES. Here you will find code that sets mode (changeable / readonly) each attribute.
    Follow below steps :-
    - Create a Zclass and inherit it from the above class.
    - Redefine the above method.
    - Set attributes to changeable mode.
    Here is a sample code :-
      DATA: lv_attr_props       TYPE REF TO if_genil_obj_attr_properties.
    * First get the property object
      lv_attr_props = iv_object->get_attr_props_obj( ).
      lv_attr_props->set_property_by_name( iv_name  = 'Field1'
                                           iv_value = if_genil_obj_attr_properties=>changeable ).
      lv_attr_props->set_property_by_name( iv_name  = 'Field2'
                                           iv_value = if_genil_obj_attr_properties=>changeable ).
    Alternatively you can set attribute properties for all fields at once :-
    * set property 'changeable' for all attributes
      lv_attr_props->set_all_properties( if_genil_obj_attr_properties=>changeable ).
    Thanks,
    Ashish

  • How to set dynamic value for field Month when running background job ?

    Dear guys,
    I have a Z* report in our company, in the selection screen there is a period field (Month and Year) and this report running in background job periodically. My Question is how i can set for Month field become dynamic follow month value of date when this report executed ?
    Example :
    When Z* report running in background on 16.04.2008, Month Value will be 04 and when running on 16.05.2008, Month Value will be 05.
    Please advice.
    Regards
    Gunawan

    Dear guys,
    I have a Z* report in our company, in the selection screen there is a period field (Month and Year) and this report running in background job periodically. My Question is how i can set for Month field become dynamic follow month value of date when this report executed ?
    Example :
    When Z* report running in background on 16.04.2008, Month Value will be 04 and when running on 16.05.2008, Month Value will be 05.
    Please advice.
    Regards
    Gunawan

  • Setting Dynamic values to the payload-name / Content Desc

    Hi All,
    I am using a PayloadZIp module and i am trying to zip the file and retain the filename.
    For this i have done the following things. I have used PayloadZIp in the Sender channel. In the recv channel used the DynamicConfigurationBean and wrote the value as a part of message_interface and then using variable substitution i have configured made the filename as the sender name.zip
    for eg if the file zipped at the sender side is name1.txt the recv channel would be name1.txt.zip where the variable substituiton would have the value name1.txt
    but the problem is that the value of the file inside the zip is not name1,txt . I would like it to be name1.txt
    I have used the messageTransformBean and stuff tried setting the ContentTypes Desc all of them take constant values. i am not able to set the real filename as the filename for the attachment.
    Can anyone share their views on this and let meknow hw i can achieve this
    Rgds
    aditya

    Hi
    > I am using a PayloadZIp module and i am trying to zip the file and retain the filename.
    > For this i have done the following things. I have used PayloadZIp in the Sender channel.
    If you are trying to zip a file, then why are you using the PayloadZipbean on the Sender CC, you should use the module on the Receiver CC.
    > for eg if the file zipped at the sender side is name1.txt the recv channel would be name1.txt.zip where the variable substituiton would have the value name1.txt
    >
    > but the problem is that the value of the file inside the zip is not name1,txt . I would like it to be name1.txt
    >
    What file name are you getting now?
    have a look at this blog : http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417700%29ID0591392850DB01436613452367233705End?blog=/pub/wlg/5899
    Pooja.

  • How to set dynamic value

    in my xslt i
    <div>..in in loop and i want to give each div a unique id
    .like this...
    <div id = node01>
    <div id = node03>
    <div id = node04>
    how to do that...mens in my xsl what will be the expression pls give a example..

    I suppose you could use the <xsl:number> element. It really depends on the context of where and how you want to produce these numbers, though.

Maybe you are looking for

  • Files copied from UDF data dvd are Read-only

    I have a bunch on data DVDs burnt on a pc using Roxio Easy Media Creator 7. These disks are UDF format and can be read perfectly on pc or mac. The problem is : if I copy a file to my desktop, it becomes owned by me but r-xr-xr-x. It's not a problem f

  • Lync slow connection issues, long login times

    hi i currently have this issue with uses externally over the Wan connecting to lync server. the users are experiencing long log in times. i have attached a link for the decrypted wireshark file. any assistance will be much appreciated.

  • How Create New Folder in KM with Name having Special Character

    Hi, How to create new Folder in KM with name having special character in it. Right now its not allowing me to create folder when i have Colon( as one of the character in name of the folder. Is there a way to change this validate? Any help is appricia

  • Illustrator startet nicht mehr nach Windows 8.1 installation

    Illustrator startet nicht mehr nach Windows 8.1 installation. Weiss jemand rat? Sollte unbedingt weiterarbeiten. danke

  • Premier Elements 10 not offered for dowload

    When I try to download trial version of PE 10, I get Download Assistant but it only offfers PCE 5.     I have tried several times but it never cannot get PE 10