Forum Stats

  • 3,814,509 Users
  • 2,258,879 Discussions
  • 7,892,759 Comments

Discussions

Query only = "Yes" equivalent for ADF attribute

Robert Šajina
Robert Šajina Member Posts: 94
edited Jan 22, 2018 8:09AM in JDeveloper and ADF

Hi,

is there a property or some sort of way to say that an attribute that comes from the database is only query-able, that is, it is not included in Insert or Update statements.

I have created a entity based on database view and that view contains calculated columns for which value must not be sent when inserting/updating.
In Forms this could easily be solved by setting Query Only property to true. 

JDev 12.2.1.2.0

Thank you

Robert

Tagged:

Best Answer

  • SanjeevChauhan
    SanjeevChauhan Member Posts: 1,554 Gold Trophy
    edited Jan 22, 2018 4:19AM Answer ✓

    Ok, Got it, you want column to be considered, while queriing but not while insert/update

    You can add such attributes as transient attribute. For Default value select option SQL and specify column name. In your VO, refer transient attribute specified in EO.

    Thanks

    Sanjeev

Answers

  • SanjeevChauhan
    SanjeevChauhan Member Posts: 1,554 Gold Trophy
    edited Jan 22, 2018 3:50AM

    For calculated columns we generally use transient attributes. Transient attributes are not mapped to any column in database so they value never goes to database.

    Also for each attribute you can specify Updateable=Always, While New, Never values

    Always, means you can update that value anytime.

    While New means if row status is new then only you can update it otherwise not.

    Never means, you can't update this attribute.

    I believe for your requirement you need to use Updateable=WhileNew or Never. Mostly "While New" is good for non-updateable attributes as it gives user freedom to change attribute value while its new but once saved in database he can't change.

    There is also a property queriable at EO/VO attribute level but it serves a different purpose.

    If attribute is not queriable, you can't create view criterials (where clauses) based on that.

    Thanks

    Sanjeev

  • Robert Šajina
    Robert Šajina Member Posts: 94
    edited Jan 22, 2018 3:59AM

    Hi Sanjeev,

    thank you for your reply.

    You may have misunderstood my problem.

    The database view is based on 3 tables and some fields are calculated based on some of the values of those 3 tables.

    The attribute must always be updatable, but cannot be sent to db since it would cause an exception "virtual column not allowed here".

    In Oracle Forms this is easily solved by setting property Query Only to true for a attribute.

    I m just wondering does ADF have something that matches this behaviour

    Robert

  • SanjeevChauhan
    SanjeevChauhan Member Posts: 1,554 Gold Trophy
    edited Jan 22, 2018 4:19AM Answer ✓

    Ok, Got it, you want column to be considered, while queriing but not while insert/update

    You can add such attributes as transient attribute. For Default value select option SQL and specify column name. In your VO, refer transient attribute specified in EO.

    Thanks

    Sanjeev

  • Robert Šajina
    Robert Šajina Member Posts: 94
    edited Jan 22, 2018 8:09AM

    Hi Sanjeev,

    thank you for your help,

    it works now.


    Regards,

    Robert

This discussion has been closed.