DropDownList casting problem

Table
int id
string name
Tables extends table
Array<TableLinks> of children
TableLinks
Table rightTable
In flex, I get a list of Tables from my web service
Display a combobox with the list of Tables
Once someone selects from the list the list of TableLinks is populated in a datagrid
in the rightTable column it displays the rightTable.name in the label
When you edit the column a dropdownlist shows
<mx:DataGridColumn id="tableNameDC"
   headerText="Table"
   editable="true"
   dataField="rightTable"
   labelFunction="tableFormat"
   editorDataField="value"
   width="150">
Is there anyway to cast my Tables list to type Table here?
Currently, I keep the list as Tables
When you select and item the value is saved to a value object but casted from Tables to Table
When you exit the dropdownlist the get value function returns the Table value Object.  But for some reason, it keeps telling me its null.
Its as if when I cast the Tables item to Table it fails.
public function get value():TableDto
return rightTableDto
protected function selectableDropDown_closeHandler(event:DropDownEvent):void
rightTableDto = selectableDropDown.selectedItem as TableDto;
So, if the first question is not doable,  what do you think I am doing wrong?

Hi,
   You can use onClientSelect to trigger the javascript code.
Here is a sample code to trigger the javascript
<%String projectId="";%>
<hbj:dropdownListBox
     id="projectIdDL"
     width="110"
     onClientSelect="getStages()">
<%projectId=myContext.getParamIdForComponent(projectIdDL);%>
     </hbj:dropdownListBox>
<script>
var proid=document.getElementById('<%=projectId%>');
function getStages()
//code
</script>
Hope this will oslve your problem to trigger a javascript code when you select a value in DropdownListbox
Regards
Padmaja

Similar Messages

  • Runtime casting problems

    The following code gives me runtime casting problems:
    package edu.columbia.law.markup.test;
    import java.util.*;
    public class A {
       protected static Hashtable hash = null;
       static {
          hash = new Hashtable ();
          hash.put ("one", "value 1");
          hash.put ("two", "value 2");
       public static void main (String args []) {
           A a = new A ();
           String keys [] = a.keys ();
           for (int i = 0; i < keys.length; i++) {
               System.out.println (keys );
    public String [] keys () {
    return (String []) hash.keySet ().toArray ();
    The output on my console is:
    java.lang.ClassCastException: [Ljava.lang.Object;
            at edu.columbia.law.markup.test.A.keys(A.java:37)
            at edu.columbia.law.markup.test.A.main(A.java:29)I can not understand why is it a problem for JVM to cast?
    Any ideas?
    Thanks,
    Alex.

    return (String []) hash.keySet ().toArray ();This form of toArray returns an Object[] reference to an Object[] object. You cannot cast a reference to an Object[] object to a String[] reference for the same reason that you cannot cast a reference to a Object object to a String reference.
    You must use the alternate form of toArray instead:
    return (String []) hash.keySet ().toArray (new String[0]);This will return an Object[] reference to a String[] object, and this reference can be cast to a String[] reference.

  • Casting problems getting a home I/F of an EJB in another app when debuging a servlet

    (Jdeveloper version = 9.0.2.798, OC4J Application Server version = Oracle9iAS (9.0.2.0.0))
    I am trying to debug a multi-tier application using the embedded application server. Servlets and EJBs within that application need to call EJBs contained within a second application (Horus).
    I have set up the embedded application server to run this second application automatically by adding the following entry into its server.xml
    <application auto-start="true" name="Horus" path="M:\Studio\build\production\java\Server\Obfuscate\J2EE_HOME\Horus\Horus.xml"/>
    I then start the embedded application server by debugging my servlet project, 'intermediateServlet'. I know the second application is running correctly in the embedded application server because I can access it from a separate client.
    In the 'intermediateServlet', I want to obtain a reference to a Dispatcher EJB held in the Horus application. This EJB has the following properties
         ejb-name     = com.internal.server.Dispatcher
         home interface     = com.internal.server.DispatcherHome
         bean class     = com.internal.server.DispatcherEJB
         remote interface= com.internal.server.Dispatcher
    The following code is executed during the container's call to my servlet init( context ) method to try and get the appropriate home interface.
    Context context = null;
    Object tempRemoteIF1 = null;
    Object tempRemoteIF2 = null;
    Properties h = null;
    h = new Properties();
    h.put( Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory" );
    h.put( Context.PROVIDER_URL, "ormi://127.0.0.1:23891/Horus");
    h.put( Context.SECURITY_PRINCIPAL, "user0" );
    h.put( Context.SECURITY_CREDENTIALS, "password" );
    context = new InitialContext (h);
    tempRemoteIF1 = context.lookup( "com.internal.server.Dispatcher" );
    tempRemoteIF2 = javax.rmi.PortableRemoteObject.narrow
    tempRemoteIF1,
    Class.forName( "com.internal.server.DispatcherHome" )
    The context.lookup call seems to work fine, returning an object of the class
         DispatcherHome_StatelessSessionHomeWrapper5
    Which I presume is a containter generated class implementing the home interface. To help confirm this,
    the object has a property beanName that has the value "com.internal.server.Dispatcher".
    The problem occurs on the next line, when I check whether I can cast the object to the home interface using ProtableRemoteObject.narrow(). This gives the following exception.
    java.lang.ClassCastException
         java.lang.Object com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:296
         java.lang.Object javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:137
         com.internal.server.Dispatcher com.Studio.servlet.intermediateServlet.getDispatcherRef(java.lang.String, java.lang.String, java.lang.String)
              intermediateServlet.java:601
         void com.Studio.servlet.intermediateServlet.init(javax.servlet.ServletConfig)
              intermediateServlet.java:150
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.loadServlet(com.evermind.util.ByteString)
              HttpApplication.java:1669
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.findServlet(com.evermind.util.ByteString)
              HttpApplication.java:4001
         javax.servlet.RequestDispatcher com.evermind.server.http.HttpApplication.getRequestDispatcher(com.evermind.util.ByteString, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
              HttpApplication.java:2200
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
              HttpRequestHandler.java:580
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
              HttpRequestHandler.java:243
         void com.evermind.util.ThreadPoolThread.run()
              ThreadPoolThread.java:62
    Interestingly, if I use practically the same code, to obtain the home interface of an EJB that is defined in the application that I am debugging, the cast works perfectly. The returned object looks identical, apart from the name to the DispatcherHome_StatelessSessionHomeWrapper5 mentioned above.
    Could the error possibly be because I need to declare 'Horus' as a parent application of the application I am debugging? If it is how do I do this?
    Many thanks in advance for any help with this one.
    Mark.

    (Jdeveloper version = 9.0.2.798, OC4J Application Server version = Oracle9iAS (9.0.2.0.0))
    I am trying to debug a multi-tier application using the embedded application server. Servlets and EJBs within that application need to call EJBs contained within a second application (Horus).
    I have set up the embedded application server to run this second application automatically by adding the following entry into its server.xml
    <application auto-start="true" name="Horus" path="M:\Studio\build\production\java\Server\Obfuscate\J2EE_HOME\Horus\Horus.xml"/>
    I then start the embedded application server by debugging my servlet project, 'intermediateServlet'. I know the second application is running correctly in the embedded application server because I can access it from a separate client.
    In the 'intermediateServlet', I want to obtain a reference to a Dispatcher EJB held in the Horus application. This EJB has the following properties
         ejb-name     = com.internal.server.Dispatcher
         home interface     = com.internal.server.DispatcherHome
         bean class     = com.internal.server.DispatcherEJB
         remote interface= com.internal.server.Dispatcher
    The following code is executed during the container's call to my servlet init( context ) method to try and get the appropriate home interface.
    Context context = null;
    Object tempRemoteIF1 = null;
    Object tempRemoteIF2 = null;
    Properties h = null;
    h = new Properties();
    h.put( Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory" );
    h.put( Context.PROVIDER_URL, "ormi://127.0.0.1:23891/Horus");
    h.put( Context.SECURITY_PRINCIPAL, "user0" );
    h.put( Context.SECURITY_CREDENTIALS, "password" );
    context = new InitialContext (h);
    tempRemoteIF1 = context.lookup( "com.internal.server.Dispatcher" );
    tempRemoteIF2 = javax.rmi.PortableRemoteObject.narrow
    tempRemoteIF1,
    Class.forName( "com.internal.server.DispatcherHome" )
    The context.lookup call seems to work fine, returning an object of the class
         DispatcherHome_StatelessSessionHomeWrapper5
    Which I presume is a containter generated class implementing the home interface. To help confirm this,
    the object has a property beanName that has the value "com.internal.server.Dispatcher".
    The problem occurs on the next line, when I check whether I can cast the object to the home interface using ProtableRemoteObject.narrow(). This gives the following exception.
    java.lang.ClassCastException
         java.lang.Object com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:296
         java.lang.Object javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:137
         com.internal.server.Dispatcher com.Studio.servlet.intermediateServlet.getDispatcherRef(java.lang.String, java.lang.String, java.lang.String)
              intermediateServlet.java:601
         void com.Studio.servlet.intermediateServlet.init(javax.servlet.ServletConfig)
              intermediateServlet.java:150
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.loadServlet(com.evermind.util.ByteString)
              HttpApplication.java:1669
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.findServlet(com.evermind.util.ByteString)
              HttpApplication.java:4001
         javax.servlet.RequestDispatcher com.evermind.server.http.HttpApplication.getRequestDispatcher(com.evermind.util.ByteString, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
              HttpApplication.java:2200
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
              HttpRequestHandler.java:580
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
              HttpRequestHandler.java:243
         void com.evermind.util.ThreadPoolThread.run()
              ThreadPoolThread.java:62
    Interestingly, if I use practically the same code, to obtain the home interface of an EJB that is defined in the application that I am debugging, the cast works perfectly. The returned object looks identical, apart from the name to the DispatcherHome_StatelessSessionHomeWrapper5 mentioned above.
    Could the error possibly be because I need to declare 'Horus' as a parent application of the application I am debugging? If it is how do I do this?
    Many thanks in advance for any help with this one.
    Mark. Try loading the home interface from the same classloader used to load the the returned home object.
    tempRemoteIF2 = javax.rmi.PortableRemoteObject.narrow
    ( tempRemoteIF1,
    tempRemoteIF1.getClass().getClassLoader().loadClass("com.internal.server.DispatcherHome" )
    Dhiraj

  • Class casting problems in JSP's

    Folks,
              Several people, including myself, have written about the problems they
              ran into when trying to cast a class in JSP's. The following link might
              provide the answer:
              http://www.weblogic.com/docs51/classdocs/API_jsp.html#sessions
              I believe this is a major limitation Weblogic put on web app
              development, and hope BEA would eventually find a way to allow non-user
              defined types being stored in servlet sessions.
              Jeff
              

    Folks,
              Several people, including myself, have written about the problems they
              ran into when trying to cast a class in JSP's. The following link might
              provide the answer:
              http://www.weblogic.com/docs51/classdocs/API_jsp.html#sessions
              I believe this is a major limitation Weblogic put on web app
              development, and hope BEA would eventually find a way to allow non-user
              defined types being stored in servlet sessions.
              Jeff
              

  • 10gr2 TABLE(CAST( problem

    We have an existing report that uses existing function to table cast back data in the from clause. A very simplified example:
    FROM grant g, grantparticipant gt, table(cast(getSchedule(g.grant_pk, gt.grantparticipant_pk) as r_sched)) sched
    where g.grant_pk = gt.grant_fk
    and sched.grantparticipant_pk = gt.grantparticipant_pk
    The grantparticipant_pk is NULL when captured in the function. There are no null values in the table (it's a primary key). When the where clause is changed to reference a specific pk it works fine and the value is filled in.
    The works in our production db where the Oracle version is 10g. It works in development which is also 10g. The problem only appears to be with our 10gr2 DB.
    Any ideas....

    The problem was solved with ANSI JOINs. Would still like to know why that problem occurred?

  • Shareable object interface cast problem

    Hi,
    I'm a student working on building a shareable object interface between two applets namely "EWallet" and "EPhone".
    I currently use the javacard 2.2.X version and I mean to solve the shareable object interface in this version.
    Thus not with servlets in 3.X.X.
    The current problem I'm facing is the casting from the base type of shareable interface objects (Shareable) to the EWalletInterface which I need to do operations on the SIO of EWallet.
    The code snippet of the EWallet applet (server)
    public void verify(byte[] pincode) {
    if ( pin.check(pincode, (short)0,(byte)(short)pincode.length) == false )
    ISOException.throwIt(SW_VERIFICATION_FAILED);
    public void debit(byte debitAmount) {
    if (!pin.isValidated())
    ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED);
    // check debit amount
    if ((debitAmount > MAX_TRANSACTION_AMOUNT) || (debitAmount < 0))
    ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT);
    // check the new balance
    if ((short)(balance - debitAmount) < (short)0)
    ISOException.throwIt(SW_NEGATIVE_BALANCE);
    balance = (short)(balance - debitAmount);
    public Shareable getShareableInterfaceObject(AID client_aid, byte parameter){
    byte[] ephone_aid_bytes = {(byte)0X15, (byte)0XEF, (byte)0X4D, (byte)0X55, (byte)0X86, (byte)0X60};
    if(client_aid.equals(ephone_aid_bytes,(short)0,(byte)ephone_aid_bytes.length) == false)
    return null;
    if(parameter != (byte)0x01)
    return null;
    return this;
    The code snippet of the EPhone applet (client)
    //Helper method
    private void makeBankcardDebit(short amount){
    AID ewallet_aid = JCSystem.lookupAID(ewallet_aid_bytes,(short)0,(byte)ewallet_aid_bytes.length);
    if(ewallet_aid == null)
    ISOException.throwIt(SW_EWALLET_AID_NOT_EXIST);
    //Error with casting from Shareable to EWalletInterface
    EWalletInterface sio = (EWalletInterface)(JCSystem.getAppletShareableInterfaceObject(ewallet_aid, (byte)0x01));
    if(sio == null)
    ISOException.throwIt(SW_FAILED_TO_OBTAIN_SIO);
    byte[] pin = new byte[4];
    sio.verify(pin);
    sio.debit((byte)amount);
    this.balance = (short)(this.balance + amount);
    The EWalletInterface code snippet
    public interface EWalletInterface extends Shareable {
    public void verify(byte[] pincode);
    public void debit(byte amount);
    The interface is currently both in the EWallet and EPhone packages.
    The problem i'm facing is that in the code snippet of EPhone.
    The "lookupAID"- and "getAppletShareableInterfaceObject"-methods work
    The casting from Shareable to EWalletInterface gives me status word 0x6F00 which presents me with a google explanation of "No precise diagnosis".
    Does anyone have an idea why the cast from Shareable to EWalletInterface doesn't work?
    Thanks in advance,
    Jeroen

    Hi,
    What happens if you get the SOI reference and store in a Shareable and see if it is null? Just to confirm, the two applets are in different packages and the server applet has be installed and is selectable?
    If you get 0x6F00, you should start adding try/catch blocks to find the root cause.
    Cheers,
    Shane
    =================================
    Reposting with &#123;code} tags
    =================================
    Hi,
    I'm a student working on building a shareable object interface between two applets namely "EWallet" and "EPhone".
    I currently use the javacard 2.2.X version and I mean to solve the shareable object interface in this version.
    Thus not with servlets in 3.X.X.
    The current problem I'm facing is the casting from the base type of shareable interface objects (Shareable) to the EWalletInterface which I need to do operations on the SIO of EWallet.
    The code snippet of the EWallet applet (server)
        public void verify(byte[] pincode) {
            if ( pin.check(pincode, (short)0,(byte)(short)pincode.length) == false )
                ISOException.throwIt(SW_VERIFICATION_FAILED);
        public void debit(byte debitAmount) {
            if (!pin.isValidated())
                ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED);
            // check debit amount
            if ((debitAmount > MAX_TRANSACTION_AMOUNT) || (debitAmount < 0))
               ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT);
            // check the new balance
            if ((short)(balance - debitAmount) < (short)0)
                 ISOException.throwIt(SW_NEGATIVE_BALANCE);
            balance = (short)(balance - debitAmount);
        public Shareable getShareableInterfaceObject(AID client_aid, byte parameter){
            byte[] ephone_aid_bytes = {(byte)0X15, (byte)0XEF, (byte)0X4D, (byte)0X55, (byte)0X86, (byte)0X60};
            if(client_aid.equals(ephone_aid_bytes,(short)0,(byte)ephone_aid_bytes.length) == false)
                return null;
            if(parameter != (byte)0x01)
                return null;
            return this;
    The code snippet of the EPhone applet (client)
       //Helper method
        private void makeBankcardDebit(short amount){
            AID ewallet_aid = JCSystem.lookupAID(ewallet_aid_bytes,(short)0,(byte)ewallet_aid_bytes.length);
            if(ewallet_aid == null)
               ISOException.throwIt(SW_EWALLET_AID_NOT_EXIST);
            //Error with casting from Shareable to EWalletInterface
            EWalletInterface sio = (EWalletInterface)(JCSystem.getAppletShareableInterfaceObject(ewallet_aid, (byte)0x01));
            if(sio == null)
              ISOException.throwIt(SW_FAILED_TO_OBTAIN_SIO);
            byte[] pin = new byte[4];
            sio.verify(pin);
            sio.debit((byte)amount);
            this.balance = (short)(this.balance + amount);
    The EWalletInterface code snippet
        public interface EWalletInterface extends Shareable {
            public void verify(byte[] pincode);
            public void debit(byte amount);
        }The interface is currently both in the EWallet and EPhone packages.
    The problem i'm facing is that in the code snippet of EPhone.
    The "lookupAID"- and "getAppletShareableInterfaceObject"-methods work
    The casting from Shareable to EWalletInterface gives me status word 0x6F00 which presents me with a google explanation of "No precise diagnosis".
    Does anyone have an idea why the cast from Shareable to EWalletInterface doesn't work?
    Thanks in advance,
    Jeroen

  • Magenta color cast problem on canon 7d raw files

    when i import canon raw files (cr2) into lightroom 3, i get a magenta color cast over the whole image. the thumbnail image looks fine, but when lightroom opens up the image, it get's a magenta color cast over the whole thing. i shot raw+jpeg mode too, and there's a huge differnce in color between the two. the jpeg looks like how i shot it in camera but the raw image has the ugly magenta color. not only do i get this ugly color, but it seems like there's added noise compared to jpeg image.
    i tried converting the cr2 into a dng. but when i open that in lightroom, i get the same problem.
    i use aperture 2.1 (i only use the lr3 trial so far), but i have the same problem there.
    i use cs3 but i downloaded cs5 trial.
    acr i have is 6.1
    help.
    thanks.

    Go to develop and the callibration tab and change it in the pull down menu to a canon default like 'Neutral' and not the adobe one which is made by somebody totally colour blind or obviously a Nikon fan.
    Although this is weird as the problem for me has always been canon JPG's with the cast and not the RAW.
    Also check your white balance cause Lightroom seems to change it whatever..  'AS SHOT' is a big fat Adobe lie so use a preset from your camera in the drop down box.. Why?  I shoot with Canon's flash WB setting which i know to be 5500k with the tint at zero.  On import, Lightroom changes it to 6150 and adds an amazing +7 on the magenta tint, if i chose 'FLASH' things suddenly turn to what i see on the camera LCD..  I'm sure that is where the big fat tint has come from since day one.

  • Generic Observer - Casting problems..

    I'm trying to make a generic observer pattern, modeled after Wadler's book.
    But I get type errors at the lines marked with ?? below, and although I fixed them, don't understand why the original code is wrong - any help please!
    interface Observer<S extends Observable<S,O,A>,
                           O extends Observer  <S,O,A>,
                           A > {
         public void update ( S subject, A arg);
         // public void update ( Observable<S,O,A> subject, A arg);
    abstract class Observable<S extends Observable<S,O,A>,
                                 O extends Observer  <S,O,A>,
                                 A > {
         List<Observer<S,O,A>> obs = new ArrayList<Observer<S,O,A>>();
         boolean changed = false;
        public void          notifyObservers(A a){
             // for ( O o : obs )            // ??
             //    o.update(this,a);          // ??
             for ( Observer<S,O,A> o : obs )
                  o.update((S)this,a );     // Cast??
    }

    Stephan,
    To illustrate the problem with your version and a client;
    The type TestObsGen must implement the inherited abstract method Observer<Thing,TestObsGen,Integer>.update(Observable<Thing,TestObsGen,Integer>, Integer)
    Any insights welcome!
    public interface Observer<
         S extends Observable<S, O, A>,
         O extends Observer<S, O, A>,
         A> {
        public void update(Observable<S, O, A> subject, A arg);
    abstract class Observable<
                   S extends Observable<S, O, A>,
                   O extends Observer<S, O, A>,
                   A> {
        List<Observer<S, O, A>> obs = new ArrayList<Observer<S, O, A>>();
        boolean changed = false;
        public void notifyObservers(A a) {
            for (Observer<S, O, A> o : obs)
                o.update(this, a);
    public class TestObsGen
         implements Observer< Thing, TestObsGen, Integer >
         Thing thing;
         TestObsGen ( Thing t ) {
              thing = t;
              // t.addObserver(this);
         void update(Thing t, Integer count) {
              System.out.println("Count:" + count);
         public static void main(String[] args) {
              Thing t = new Thing();
              TestObsGen test = new TestObsGen(t);
              t.bump();
              // Event received?!
    class Thing
         extends Observable< Thing, TestObsGen, Integer >
         int count;
         void bump() {
              count++;
              // setChanged();
              // notifyObservers();
    }

  • Dropdownlist values problem urgent

    Hi all,
    I developed a page in jdev 9.0.3. And I deployed to R11 application. Page needs user id to generate data for the dropdownlist in view objects where clause like user_id = fnd_profile('USER_ID'). When I open the page after restarting apache there is no problem with the dropdownlist controlled by such view object. But when I open the page for other users dropdown list values still the same values of the first user for the same page even they must be different for some of the users. What can be the problem I missed here?
    Thanks in advance for your help.

    Try calling setPickListCacheEnabled(false) on the Poplist bean..
    Cheers,
    Ganesh

  • Output Parameter cast problems

    Wondering if anyone has seen this ...
    Migrating a data access layer (based on the MS DAAB) using the ODP.NET provider. I wrote my own parameter discovery code to dynamically configure parameters at runtime - just like the SqlCommandBuilder.DeriveParameters() method does for SQL Server sprocs.
    (I query the "all_arguments" view to get this data, by the way, passing the package name and procedure name.)
    Here's the problem: you cannot discover the Size property for a parameter via this query. Bummer. So for VarChar2 and Char types I tried setting the Size to somethng big, like 2000.
    When I retrieve the parameters after an ExecuteNonQuery statement, I am getting Type cast errors:
    "Cast from type 'OracleString' to type 'String' is not valid"
    Here's the weird part:
    - CType(params(5).Value, Integer) 'WORKS
    - CType(params(2).Value, String) 'DOESN'T WORK
    - params(2).Value.ToString 'WORKS
    - CType(params(2).Value, Date) 'DOESN'T WORK
    What the ...? Why can't I cast a VarChar2 or Char type back to a .NET String? Why does ToString work but Ctype() not work?
    I hope somebody can offer guidance, I've got a lot invested in this DAL :-)
    Thanks eh
    Kurt Mang
    Vancouver BC

    There's not really an elegant way to provide these conversions in VB. In C# OracleString uses operator overloading to provide type conversions, but this version of VB doesn't support it.
    They might have implemented IConvertible on the oracle types.
    Then you could write
    Dim osw as new OracleString("Hello")
    Dim s as String = CType(osw, IConvertible).ToString
    But that's not really better than
    Dim osw as new OracleString("Hello")
    Dim s as String = osw.Value
    The long and short of it is, OracleTypes ( and other ADO.NET provider types), are special high-performance types (usually value types), and they convert using a different idiom. By convention they are converted to the corresponding framework type using a property called .Value, and constructed from framework types using a constructor.
    String s = New OracleString("Hello").Value
    Converts the Unicode string "Hello" to an OracleString structure, and then back to a unicode string.
    David

  • Object view multi-cast problem

    We are using the following object to generate XML the output for multi=cast is prodicing an unwanted extra tag "*_ITEM"
    Any ideias??
    CREATE OR REPLACE VIEW sjs.arrest_obj_view
    AS SELECT CAST(MULTISET(SELECT 'ERROR NEEDED ' FROM dual) AS errors_type) AS "Errors",
    a.a_date AS "ArrestDate",
    NVL(a.a_photo_num,'NULL') AS "PhotographNumber",
    NVL(a.a_division,'NULL') AS "AgencyDivision",
    'MODEL MAPPING PROBLEM' AS "ArrestType",
    NVL(agcy.agcy_ori,'NULL') AS "ArrestingAgency",
    a.a_id AS "ArrestNumber",
    NVL(oa.o_number,'NULL') AS "ArrestingOfficerID",
    NVL(o.o_number,'NULL') AS "AssistingOfficerID",
    'MODEL MAPPING PROBLEM' AS "AssistingAgency",
    'MODEL MAPPING PROBLEM' AS "CJTN",
    CAST(MULTISET(SELECT l.lu_name AS "Weapon"
    FROM sjs.arrestweapons awm,
    sjs.lookuptable l
    WHERE awm.a_id = a.a_id
    AND awm.weapons_id = lu_id (+)) AS arrest_weapons_type) AS "ArrestWeapons"
    FROM sjs.arrest a,
    sjs.agency agcy,
    sjs.officers o,
    sjs.officers oa
    WHERE a.agcy_id = agcy.agcy_id (+)
    AND a.o_arrest_id = oa.o_id (+)
    AND a.o_assist_id = o.o_id (+)
    - <ROWSET>
    - <ROW num="1">
    <InterfaceTransaction>ADD</InterfaceTransaction>
    <Resubmission>RESUBMISSION NEEDED</Resubmission>
    <SubmittingAgency>NY1111111</SubmittingAgency>
    <SubmittingEmployeeID>FFOTI</SubmittingEmployeeID>
    <TOT>TOT NEEDED</TOT>
    - <Errors>
    - <Errors_ITEM>
    <Error>ERROR NEEDED</Error>
    </Errors_ITEM>
    </Errors>
    <ArrestDate>3/18/2002 9:40:0</ArrestDate>
    <PhotographNumber>PPPPP</PhotographNumber>
    <AgencyDivision>PPP</AgencyDivision>
    <ArrestType>MODEL MAPPING PROBLEM</ArrestType>
    <ArrestingAgency>NY1111111</ArrestingAgency>
    <ArrestNumber>1</ArrestNumber>
    <ArrestingOfficerID>NULL</ArrestingOfficerID>
    <AssistingOfficerID>NULL</AssistingOfficerID>
    <AssistingAgency>MODEL MAPPING PROBLEM</AssistingAgency>
    <CJTN>MODEL MAPPING PROBLEM</CJTN>
    - <ArrestWeapons>
    - <ArrestWeapons_ITEM>
    <Weapon>FULLY AUTOMATIC RIFLE OR MACHINE GUN</Weapon>
    </ArrestWeapons_ITEM>
    - <ArrestWeapons_ITEM>
    <Weapon>FIRE/INCENDIARY DEVICE</Weapon>
    </ArrestWeapons_ITEM>
    </ArrestWeapons>
    </ROW>
    </ROWSET>

    How would you replace the multi-cast within the object with cursor?
    Thanks

  • Casting problems

    Having some problems casting, or converting, and I'm not really sure why!
    Here is a code snippit, with the problem line commented.
    public void focusLost(FocusEvent focEvent) {
            Field[] aField = this.getClass().getDeclaredFields();
            Method[] aMethod = myEr.getClass().getDeclaredMethods();
            for(int e = 0; e < aField.length; e++) {
                if(aField.getClass().toString().equals("javax.swing.JTextField")) {
                    //This next line isn't quite working! :(
                    JTextField tempField = ((JTextField)aField[e]);
                    for(int q = 0; q < aMethod.length; q++) {
                        if(aMethod[q].toString().contains("set"+aField[e].toString())) {
                            aMethod[q].invoke(myEr, tempField.getText());
        }I've also tried not using tempField and instead trying something like (JTextField)aField[e].getText();
    Though I've been using java for a while now for school and just to write little apps casting has always been something I've never really studied enough to figure out why I'm having a problem. I've tried google but can't find very good information on this, and the java API docs really don't give much about object conversion, but instead talk more of primitive casting, etc (unless I'm looking in the wrong places)
    Thanks in advance!

    Thanks Ron, I'll check out the API on that. The name's Monica.Oops, sorry!
    Also, where would I want to use this instanceof
    operator? If I try to use aField[e] instanceof
    JTextField it won't work because aField is of type
    field, and aField[e].getClass() or .getType() are
    dynamically determined (and it the api said itwon't
    work on those).instanceof is also dynamic.Heres what happens when I try that
    /home/untwisted/sahtbidb/src/gui/sah/Er.java:455: inconvertible types
    found : java.lang.reflect.Field
    required: javax.swing.JTextField
    if(aField[e] instanceof JTextField) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Class Casting problem

    hi,
    i�ve loaded a class at runtime and to parse it to another type, also loaded at runtime, but an error occures!
    in this code i dont write the try�s and catches, they doesn�t matter in this problem
    Class prototype; //source class
    Class parser;    //target class
    Class parsed;    //parsed class (source -> target / prototype -> parser)
    prototype = Class.forName("Prototype");
    parser    = Class.forName("Parser");
    parsed    = (parser) prototype; //Compiler: "Class parser not found"what does it mean?
    can somebody help me?
    thx anyway
    cu Errraddicator

    parser    = Class.forName("Parser");
    parsed    = (parser) prototype; //Compiler: "Class1st. "Parser" or "parser" ... what's the name of your class?
    2nd. all your variables are of type Class. why would you want something of type Class cast into type Parser and then assign it back to a variable of class parsed?
    try something like:
    Class parserClass = Class.forName("Parser");
    Parser parser = (Parser) parserClass.newInstance();of course this is not really THE way to construct an object if you know about the Class type beforehand....
    ulrich

  • Wide casting problem

    Hi All,
    Can u explain Wide casting in detail ? already i gone through sdn links but still i didnt get clear .  please go through the follwing code snippet and explain where i made mistake in order to getting wide casting.. my problem is as wide casting i want to access the base class methods with reference of sub class when the base class methods are redefined in sub class(actually sub class reference access the  subclass methods only if we have same methods in base and as well as sub class) in my program after performing wide cast also it is accessing sub class methods only please send the answer.
    REPORT  ZNARROW_WIDE.
    CLASS C1 DEFINITION.
    PUBLIC SECTION.
    METHODS:M1,M2.
    ENDCLASS.
    CLASS C1 IMPLEMENTATION.
    METHOD M1.
    WRITE:/ ' THIS IS SUPER CLASS METHOD M1'.
    ENDMETHOD.
    METHOD M2.
    WRITE:/ ' THIS IS SUPER CLASS METHOD M2'.
    ENDMETHOD.
    ENDCLASS.
    CLASS C2 DEFINITION INHERITING FROM C1.
    PUBLIC SECTION.
    METHODS:M1 REDEFINITION.
    METHODS:M2 REDEFINITION,
                      M3.
    ENDCLASS.
    CLASS C2 IMPLEMENTATION.
    METHOD M1.
    WRITE:/ ' THIS IS SUB CLASS METHOD M1'.
    ENDMETHOD.
    METHOD M2.
    WRITE:/ ' THIS IS SUBCLASS METHOD M2'.
    ENDMETHOD.
    METHOD M3.
    WRITE:/ ' THIS IS SUB CLASS METHOD M3'.
    ENDMETHOD.
    ENDCLASS.
    DATA:O_SUPER TYPE REF TO C1,
         O_SUB TYPE REF TO C2.
    START-OF-SELECTION.
    CREATE OBJECT O_SUPER.
    CREATE OBJECT O_SUB.
    CALL METHOD O_SUPER->M1.
    CALL METHOD O_SUPER->M2.
    CLEAR O_SUPER.
    O_SUPER = O_SUB.
    CALL METHOD O_SUPER->('M3').
    SKIP 5.
    ULINE 1(80).
    CLEAR O_SUB.
    O_SUB ?= O_SUPER.
    CALL METHOD O_SUB->M1.
    CALL METHOD O_SUB->M2.
    CALL METHOD O_SUB->M3.
    Thanks in advance.
    sreenivas P

    Hi,
    consider the following sample code:
    REPORT  ZA_TEST93.
    class class_super definition.
      public section.
        data: var_area type i.
        methods:
        area importing length type i breadth type i.
    endclass.
    class class_super implementation.
      method area.
        var_area = length * breadth.
        write:/ 'Area of rectangle = '.
        write: var_area.
      endmethod.
    endclass.
    class class_sub definition inheriting from class_super.
      public section.
      data:height type i.
      methods:
      area redefinition.
    endclass.
    class class_sub implementation.
      method area.
        var_area = 6 * length * breadth * height.
        write:/ 'Area of the cube ='.
        write: var_area.
      endmethod.
    endclass.
    start-of-selection.
    data: object_superclass type ref to class_super,
          object_subclass type ref to class_sub,
          object2_superclass type ref to class_super.
    create object object_superclass.
    create object object2_superclass.
    create object object_subclass.
    call method object_superclass->area exporting length = 10 breadth = 5.
    "Narrow casting
    object_subclass->height = 10.
    object_superclass = object_subclass.
    call method object_superclass->area exporting length = 10 breadth = 10.
    "Wide casting
    object_superclass ?= object2_superclass.
    call method object_superclass->area exporting length = 10 breadth = 5.
    Explanation:
    In the above code, consider the super class named 'class_super'.
    This class has a method called 'area' which is used to calculate the area of a rectangle.
    Consider the subclass 'class_sub', which inherits all the attributes and methods of super class 'class_super'.
    Now we want to use the same method of super class 'class_super', 'area', but this time we want it to calculate the area of a cube.
    For this purpose we use the 'redefinition' keyword in the definition part of 'class_sub' and enter the code for cube area calculation in the 'area' method body in the implementation part of 'class_sub'.
    From the above code, consider the following code snippet:
    create object object_superclass.
    create object object2_superclass.
    create object object_subclass.
    call method object_superclass->area exporting length = 10 breadth = 5.
    Explanation: Two objects of the superclass and one object of the subclass are created and the 'area' method of the superclass is called to compute the area of a rectangle.
    Now consider what comes next:
    "Narrow casting
    object_subclass->height = 10.
    object_superclass = object_subclass.
    call method object_superclass->area exporting length = 10 breadth = 10.
    Explanation:
    We assign a value of 10 to the 'height' instance variable of the subclass object.
    Then we perform narrow casting in the next line(object_superclass = object_subclass.).
    Now the instance of the superclass(object_superclass) now points or refers to the object of the subclass, thus the modified method 'area' of the subclass is now accessible.
    Then we call this method 'area' of the subclass to compute the area of the cube.
    Moving on to the final piece of code:
    "Wide casting
    object_superclass ?= object2_superclass.
    call method object_superclass->area exporting length = 10 breadth = 5.
    Explanation:
    The object 'object_superclass' now refers to the object of the subclass 'object_subclass'.
    Thus the 'area' method of the superclass cannot be called by this object.
    In order to enable it to call the 'area' method of the superclass, wide casting has to be perfomed.
    For this purpose, the RHS of the wide casting must always be an object of a superclass, and the LHS of the wide casting must always be an object reference declared as 'type ref to' the superclass(objectsuperclass ?= object2_superclass.)._
    Otherwise a runtime error will occur.
    Finally the 'area' method of the superclass can now be called once again to compute the area of the rectangle.
    The output of the above example program is as follows:
    Area of rectangle =          50
    Area of the cube =      6,000
    Area of rectangle =          50
    Also note that wide casting cannot be performed on subclass objects, wide casting can only be performed on superclass objects that have been narrow cast.
    Hope my explanation was useful,
    Regards,
    Adithya.
    Edited by: Adithya K Ramesh on Dec 21, 2011 11:49 AM
    Edited by: Adithya K Ramesh on Dec 21, 2011 11:51 AM

  • Jtree casting problem

    Hi ,
    I am new to java swings, I am having problem with jtree casting.
    I have the tree which I created in the similar way as DNDTree
    The tree has 4 types such as model/subject/entity/attribues each
    of different class. My problem is when I drag and drop .. later I have
    to save the tree with all the properties into respective tables. Please
    help me how do I accomplish.
    Thanks

    Hi, This is the error I m getting.
    Excpetion is javax.swing.tree.DefaultMutableTreeNode cannot be cast to com.idecisions.cdi.hme_prac.MySubjectNodejava.lang.ClassCastException: javax.swing.tree.DefaultMutableTreeNode cannot be cast to com.idecisions.cdi.hme_prac.MySubjectNode
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

Maybe you are looking for

  • My macbook pro won't boot, I just get the apple logo but no progression.

    P.S. (pre script) I'm in the UK I think my macbook's Hard-drive is capooot, here's my symptoms, windows takes 10-15 minutes to boot and when it does every program I open becomes non responsive every 20 seconds or so, so it's unusable. I've tried play

  • Lumia 925

    Heyy.. I'm nt able to find de call+SMS block feature on ma lumia925? Tryd checkn on de call log screen.. I gt nly one option. Delete. No blocking feature

  • Smartforms to PDF in Multilanguage

    Hi, we need to convert smartforms to PDF in 13 languages. It works fine for all languages but PL and RU. I've already played around with different device types and code pages but I couldn't get it straight. I would really appreciate any idea! At the

  • Listening to ipod touch in car- bluetooth or FM?

    hello, i would like to listen to 3rd gen i-touch in the car. I have a motorola HF850 car hands free kit (bought from carphone warehouse) and hoped this would pair with the touch, but no luck. Have tried performing 'device discovery' on car kit, bluet

  • Preset management makes no logical sense...

    The Premiere Pro CC 2014 preset management makes no sense based on the aliasing of the original preset. What is considered the norm with presets in most applications is having a custom bin/folder with a naming convention that follows the paradigm of