Changing Attribute Type on View Object Query
Hi All,
I am using JDeveloper 11.1.1.6. I am trying to achieve the following problem.
My Table has a Column type VARCHAR2 but this field is to store, let's say, ExpiryDate in the canonical format "yyyy/MM/dd hh:mm:ss". I want to show the date with a nice format, like '30-Oct-12' and be able to use adf datePicker (inputDate) on the attribute.
So I have created an Entity Object and I have changed the type of the attribute from String to Date.
I have also created a ViewObject and when testing on the application module it retrieves a date but seems to don't understand the canonical format and the date it retrieves is wrong (something like 5049-02-20 12:45:30.45).
Since I am working on EBS I have access to oracle API and so on, so I modified my View Object query;
SELECT myEO.ExpiryDate from MyEO myEO ----> SELECT FND_DATE.canonical_to_date(myEO.ExpiryDate) as ExpiryDate from MyEO myEO. (FND_DATE.canonical_to_date would be the same as to_date(date,format))
When I run AppModule, NICE! It works, it retrieves the date without the time and if give simple format to the attribute I am able to even get the format I wanted.
The problem is that when I am trying to update and commit the changes to DB, (I have override the doDML so I am can parse my Date to an String with format yyyy/MM/dd hh:mm:ss as is meant to be) I cant even get to the the update part. The framework complains;
Invalid state, another user has changed the row and bla bla bla and the problem is here:
(oracle.jbo.RowInconsistentException) JBO-25014: Another user has changed the row with primary key oracle.jbo.Key[592674 ].
[178] Entity compare failed for attribute ExpiryDate
[179] Original value :2013-06-28 (the one I have parsed with my FND_DATE.CANONICAL_TO_DATE procedure)
[180] Target value :5048-02-21 22:47:53.0 (I guess the auto cast or conversion of the original string)
[181] OracleSQLBuilder: ROLLBACK WORK TO SAVEPOINT 'BO_SP'
[182] DCBindingContainer.reportException :oracle.jbo.RowInconsistentException
Any suggestion? I will really appreciate it.
Edited by: Alejandro T. Lanz on 01-Nov-2012 06:34