Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label Default Value. Show all posts
Showing posts with label Default Value. Show all posts

Friday 23 November 2012

ADF Basics: Set Default Values in Entity Object for every CreateInsert

Sometimes we have to set some same(default) values for each new row for this we use literal value option in EntityObject XML file or we can set that value in EO(EntityObject) Impl class.
EOImpl Class has a method named

 protected void create(AttributeList attributeList) {
        super.create(attributeList);
}

You can set default values there
For this we have to create Entity Impl class of EntityObject , Open EntityObject and select Java tab and click on edit icon


Check Accessors and Create Method checkbox


Now set values using accessors like this -


    /**
     * Add attribute defaulting logic in this method.
     * @param attributeList list of attribute names/values to initialize the row
     */
    protected void create(AttributeList attributeList) {
        //Setting default values
        setEmail("example@gmail.com");
        setPhoneNumber("99999999");
        super.create(attributeList);
    }


or can set in Literal Value of EO xml file

Set default value in Entity Object Literal Value

This is how you can set default values in Entity Object