NAJAF SIKANDER
NAJAF SIKANDER

Reputation: 103

How to set default value of entity/view object's attribute via SQL in Oracle adf?

I want to set default value of ID attribute in view object via a sql query , i.e :

SELECT (MAX(DEPTID) + 1) 
FROM DEPARTMENT;

so that I can use it as an auto-increment feature in oracle-adf. I have used sequences for it too via java but it doesn't fulfill my requirement. I also tried the SQL method myself, but when I deploy the form the page is returned blank and when I run app-module it doesn't work as well.

Image to show the SQL method I am implementing

Upvotes: 1

Views: 2312

Answers (1)

Joe
Joe

Reputation: 3347

I tested this exact setup on JDeveloper 12.2.1.3 (current production) and it works fine. The BC Tester and Rendered page both show the incremented max dept id.

However, the "Transient Type" for me was set to "Number" if I set the Attribute type to BigDecimal and BigInt if I selected BigInteger. I notice in your screen shot it shows the type as "$none$" - perhaps this is the issue?

Also, if you are incrementing by a whole number, why choose BigDecimal for the Type? Shouldn't it be Integer or Big Integer?

Also, in case you don't know - it's a recommended practice to put the EOs, VOs, Links, Assocs, etc. into separate packages to make it easier to read, etc. Go to Tools > Preferences > ADF Business Components > packages.

Upvotes: 1

Related Questions