This discussion is archived
4 Replies Latest reply: Mar 14, 2013 6:51 AM by 1D10T RSS

Cast EO attribute

1D10T Newbie
Currently Being Moderated
Hi ,

I need to cast attribute in Jdeveloper ADF how it is posible to do ?
jdeveloper is generated UPPER(NAME)

i need
UPPER(CAST(NAME AS VARCHAR2(100)))



Derived from SQL expresion can do that ?

ID

Studio Edition Version 11.1.1.6.0
ADF Business Components     11.1.1.61.92
  • 1. Re: Cast EO attribute
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    the EO attribute type is of the database type (the Java equivalent) which makes sense if you want to update the database. If you need to access the data as string the you access the attribute and call toString on it

    Frank
  • 2. Re: Cast EO attribute
    bigchill Newbie
    Currently Being Moderated
    I would normally use
    org.apache.commons.lang.StringUtils.uppercase(String.valueOf(getName()));

    ps: using String.valueOf(obj) method takes any object as a param and doesnt throw a class cast exception as opposed to doing a direct cast.

    Edited by: bigchill on 12/03/2013 01:43
  • 3. Re: Cast EO attribute
    bigchill Newbie
    Currently Being Moderated
    use "Helpful" or "Correct" to give points, else let us know you need some more help
  • 4. Re: Cast EO attribute
    1D10T Newbie
    Currently Being Moderated
    VO are generating Select from view , view is select * from table . Jdeveloper are adding UPPER to paramaters Like
    Select UPPER(name) from X where UPPER(name);
    
    In Select UPPER from view jdev loss his cast varchar2  Why i dont know and didnt have time to search a reason 
    I added CAST(NAME AS VARCHAR2(100)) AS NAME in Exxpresion field and all is ok .

    If this select was from table no view all was corect

    Problem solved.!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points