Casting issue

Hello Forum,
I am retrieving records from myslq database to oracle database,
in mysql, i have a date field and a time field for each record, in oracle i have a timestamp field, what i am doing is extracting the two mysql fields, then parsing to a java.util.Date and finally passing that to the destination database as a java.sql.date type. currently i am getting a java.lang.ClassCastException: java.util.Date
this is the code:
java.util.Date utilDate = new java.util.Date();
utilDate = (Date)df4.parse((df3.format(rs.getDate("EventDate")) + " " + df2.format(rs.getTime("EventTime")))); //combines the two fields into date
java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime()); // cast to sql,Date
destStmt.setDate(EDATE, sqlDate); // pass value to prepared statement

i change object to java.sql.Timestamp but it is still taking the time and set it to 12:00:00 AM
this is the output:
Inserting event 'Learn how to create and use email.
Registration required.' on 2011-06-16
this is string '16-Jun-2011 10:30:00 AM'
this is utilDate dateType '16-Jun-2011 10:30:00 AM'
this is the timestamp: '2011-06-16 10:30:00.0'
Inserting event 'Learn how to create and use email.
Registration required.' on 2011-07-21
this is string '21-Jul-2011 10:30:00 AM'
this is utilDate dateType '21-Jul-2011 10:30:00 AM'
this is the timestamp: '2011-07-21 10:30:00.0'
Inserting event 'Learn how to create and use email.
Registration required.' on 2011-08-18
this is string '18-Aug-2011 10:30:00 AM'
this is utilDate dateType '18-Aug-2011 10:30:00 AM'
this is the timestamp: *'2011-08-18 10:30:00.0'*
this is the code:
java.sql.Timestamp finalDate = new java.sql.Timestamp(utilDate.getTime());
System.out.println("this is the timestamp: '" + finalDate + "' ");
destStmt.setTimestamp(EDATE, finalDate);
this is the date that is writing to database:
*14-May-2011 12:00:00 AM*

Similar Messages

  • Type casting issue

    Hello All,
    I've a Type casting issue. Could yu please help me resolving it.
    I'm trying to initialize the variable v with sysdate ('mon-dd-yy:hh:mi:ss') but couldn't initialize. I was able to do that in the body but is it not possible to do it in the declaration part?
    I was able to do like this
    DECLARE
      v varchar2(25);
    BEGIN
      SELECT to_char(sysdate,'mon-dd-yy:hh:mi:ss') INTO v FROM dual;
      DBMS_OUTPUT.PUT_LINE(v);
    END;
    Output looks like this: jan-19-12:04:32:11But how to do it in delaration part?
    DECLARE
      v varchar2(25);
      v := to_date(sysdate, 'mon-dd-...') ? ? ?
    BEGIN
        DBMS_OUTPUT.PUT_LINE(v);
    END;Thx
    Shank.

    You don't need to cast a sysdate to a date. It already is a date.
    SQL> alter session set nls_date_format = 'mon-dd-yy:hh:mi:ss';
    Session altered.
    SQL>
    SQL> DECLARE
      2    v varchar2(25);
      3    v_date date:= sysdate;
      4  BEGIN
      5      DBMS_OUTPUT.PUT_LINE(v_date);
      6  END;
      7  /
    jan-19-12:04:46:40
    PL/SQL procedure successfully completed.Hope this helps.

  • Casting issue, help someone.

    I'm having a casting issue taking an ArrayList of String[] objs converting to a single String array, separated... Anyone with clues?
    String[] allDataString = new String[mCapacity];
         for (int i=(mData.size()-1); i>0; i--)
         allDataString[i] = (String)mData.get(i);               
    PELEEEEZE HEEELLP. Thanks.

    String[] allDataString = new String[mCapacity];
    for (int i=(mData.size()-1); i>0; i--)
    allDataString = (String)mData.get(i);
    }

  • Out parameter cast issue - C#

    Hi all,
    Having an issue with an older application I am supporting. The data access is CSLA .Net and there is a line that updates a newly created entity id with the value from an out parameter. This is defined in the database as NUMERIC(10,0). The code looks like this:
    OracleParameter opID = new OracleParameter("P_ID", OracleDbType.Int64);
    //... do some stuff and save the new entity to the db
    _id = (long)opID.Value;
    This used to be fine on windows XP with version 9.x of ODP .Net. On a Windows 7 box with the latest version the cast fails and the return data type Decimal. This looks to me like a bug/weird behavior in the new version. Is there a workaround or something I can do to fix the issue without, preferably without changing my code?
    Thanks!
    Matei
    Edited by: Matei on Apr 29, 2013 4:05 PM

    Yes for sure, thanks for the reply. Here are more details on the table schema and the proc that's being called. It's part of a package that does user related CRUD operations.
    ID     NUMBER(10,0)     No
    USERNAME     VARCHAR2(20 BYTE)     No
    PASSWORD     VARCHAR2(20 BYTE)
    FIRST_NAME     VARCHAR2(40 BYTE)
    LAST_NAME     VARCHAR2(40 BYTE)
    PROCEDURE insert_by_pk (
    p_id OUT fact.users.ID%TYPE,
    p_first_name IN fact.users.first_name%TYPE,
    p_last_name IN fact.users.last_name%TYPE,
    p_home_phone IN fact.users.home_phone%TYPE,
    p_business_phone IN fact.users.business_phone%TYPE,
    p_mobile_phone IN fact.users.mobile_phone%TYPE,
    p_fax IN fact.users.fax%TYPE,
    p_email IN fact.users.email%TYPE,
    p_internal IN fact.users.INTERNAL%TYPE,
    p_username IN fact.users.username%TYPE,
    p_password IN fact.users.password%TYPE,
    p_home_ext IN fact.users.home_ext%TYPE,
    p_business_ext IN fact.users.business_ext%TYPE,
    p_active          IN     fact.users.active%TYPE
    AS
    BEGIN
    INSERT INTO fact.users
    (ID, first_name,
    last_name, home_phone, business_phone,
    mobile_phone, fax, email, internal,
    username, password, home_ext, business_ext, active,
                        CREATE_USER,CREATE_DATE
    VALUES (FACT.users_seq.NEXTVAL, p_first_name,
    p_last_name, p_home_phone, p_business_phone,
    p_mobile_phone, p_fax, p_email, p_internal,
    LOWER(p_username), p_password, p_home_ext, p_business_ext, p_active,
                        (select sys_context('userenv','os_user') FROM DUAL),SYSDATE
    SELECT FACT.users_seq.CURRVAL
    INTO p_id
    FROM DUAL;
    END;
    And for completeness the C# code. The line that fails is the second to last one where the cast happens: _id = (long)opID.Value;
    // we're not being deleted, so insert or update
                                  OracleParameter opID = new OracleParameter("P_ID", OracleDbType.Int64);
                                  if(this.IsNew)
                                       // we're new so insert
                                       cm.CommandText = "FACT.users_pkg.insert_by_pk";
                                       opID.Direction = ParameterDirection.Output;
                                       cm.Parameters.Add(opID);
                                  else
                                       // we're not new, so update
                                       cm.CommandText = "FACT.users_pkg.update_by_pk";
                                       opID.Direction = ParameterDirection.Input;
                                       cm.Parameters.Add("p_id", _id);
                                  cm.Parameters.Add("p_first_name", _firstName);
                                  cm.Parameters.Add("p_last_name", _lastName);
                                  cm.Parameters.Add("p_home_phone", _homePhone);
                                  cm.Parameters.Add("p_bus_phone", _busPhone);
                                  cm.Parameters.Add("p_mobile_phone", _mobilePhone);
                                  cm.Parameters.Add("p_fax", _fax);
                                  cm.Parameters.Add("p_email", _email);
                                  cm.Parameters.Add("p_internal", _internal ? "Y" : "N");
                                  cm.Parameters.Add("p_username", _username.ToLower());
                                  cm.Parameters.Add("p_password", "password");
                                  cm.Parameters.Add("p_home_ext", _homePhoneExt);
                                  cm.Parameters.Add("p_business_ext", _busPhoneExt);
                                  cm.Parameters.Add("p_active", _active ? "Y" : "N");
                                  cm.ExecuteNonQuery();
                                  if(this.IsNew)
                                       // update ID with the oracle generated sequence
                                       _id = (long)opID.Value;
    Edited by: 1002325 on Apr 25, 2013 7:56 AM
    Edited by: 1002325 on Apr 25, 2013 7:57 AM

  • IPage - Casting Issue - Class Not Found

    EP6SP14...Encountering a funny issue...
    I am successfully compling the following code. All JAR are in place and NWDS is detecting the class and showing the methods properly. LookupObject() is able to find the object.
    import com.sap.portal.pcm.page.IPage;
    IPage page = (IPage) lookUpObject request,PcmConstants.ASPECT_SEMANTICS,pageUrl);
    lookUpObject() returns - com.sap.portal.pcm.page.admin.AttributeSetPage@81e75c
    but during Casting, it gives error...
    Caused by: java.lang.NoClassDefFoundError: com/sap/portal/pcm/page/IPage
    Any ideas what's missing???

    Hi Gulshan,
    For IPage (and IiView, ILayout, ...) you need the following reference:
    <property name="ServicesReference" value="com.sap.portal.ivs.api_iview"/>
    Hope this helps.
    Daniel

  • Private inheritance and dynamic cast issue

    Hello. I am hitting a problem combining private inheritance and dynamic casting, using Sun Studio 12 (Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25):
    I have three related classes. Let's call them:
    Handle: The basic Handle class.
    DspHandle. Handle implementation, able to add itself to a Receiver.
    IODriver. Implemented in terms of DspHandle, It is the actually instantiated object.
    Consider the following code. Sorry, but I've tried my best trying to minimize it:
    #include <iostream>
    using namespace std;
    class Handle {
    public:
    virtual ~Handle() {};
    class Receiver {
    public:
    void add(Handle &a);
    class DspHandle : public Handle {
    public:
    virtual ~DspHandle() {};
    void run(Receiver &recv);
    class IODriver : private DspHandle {
    public:
    void start(Receiver &recv) {
    DspHandle::run(recv);
    void DspHandle::run(Receiver &recv) {
    cout << "Calling Receiver::add(" << typeid(this).name() << ")" << endl;
    recv.add(*this);
    void Receiver::add(Handle &a) {
    cout << "Called Receiver::add(" << typeid(&a).name() << ")" << endl;
    DspHandle d = dynamic_cast<DspHandle>(&a);
    cout << "a= " << &a << ", d=" << d << endl;
    int main(int argc, char *argv[]) {
    Receiver recv;
    IODriver c;
    c.start(recv);
    Compiling and running this code with Sun Studio 12:
    CC -o test test.cc
    ./test
    Calling Receiver::add(DspHandle*)
    Called Receiver::add(Handle*)
    a= ffbffd54, d=0
    The dynamic cast in Receiver::add, trying to downcast Handle to DspHandle, fails.
    This same code works, for example with GNU g++ 4.1.3:
    Calling Receiver::add(P9DspHandle)
    Called Receiver::add(P6Handle)
    a= 0xbfe9c898, d=0xbfe9c898
    What is the reason of the dynamic_cast being rejected. Since the pointer is actually a DspHandle* , even when it is part of a private class, shouldn't it be downcastable to DspHandle? I think that perhaps the pointer should be rejected by Receiver::add(Handle &a) as it could be seen as a IODriver, that can't be converted to its private base. But since it's accepted, shouldn't the dynamic_cast work?
    Changing the inheritance of IODriver to public instead of private avoids the error, but it's not an option in my design.
    So, questions: Why is it failing? Any workarround?
    Best wishes.
    Manuel.

    Thanks for your fast answer.
    But could you please provide a deeper answer? I would like to know where do you think the problem is. Shouldn't the reference be accepted by Receiver:add, since it can only be seen as a Handle using its private base, or should the dynamic_cast work?
    Aren't we actually trying to cast to a private base? However, casting to private bases directly uses to be rejected in compile time. Should the *this pointer passed from the DspHandle class to Receiver be considered a pure DspHandle or a IODriver?
    Thanks a lot.

  • Simple M'Cast issue 2504

    Hi,
    I have a simple multicast setup that I can't get working. I have a Cisco WLC 2504 on version 7.4.110 (tried with 7.4.100) with one AP connected (3502). I have two SSIDs (psk limitation on apple tv) that point to the same interface with a default mdns profile attached to it. What I can not understand is why my airplay icon wont light up on my mac osx. When I connect through my corporate network (embedded LWAP on an dmvpn spoke) I can see my corporate apple tv just fine.
    I ran a packet capture and debug mdns all and I see the reply with my apple-tv sent back to the my laptop, both mdns replys look fine for the apple tv service. I am a little confused at to what is the issue. The clients default gateway for both the macbook point the svi on my vlan, and just for grins I have ip pim sparse-dense mode configured.
    I also tested with an ipad and i get the same results.
    The corporate controller I tie back into is a 5508 that is on version 7.4.100
    If there are any debugs I can provide let me know, I can clean the screenshots if anyone wants to see the packet capture. I wanted to ask to see if there is a simple setting I may be missing.
    Tarik Admani

    Yes, Since iOS 6.0.x onwards you required this AirTunes service in order to get Apple TV working with those.
    Below post may help you as well
    http://mrncciew.com/2013/03/27/configuring-mdns-on-wlc-7-4/
    HTH
    Rasika
    **** Pls rate all useful responses ****

  • Object Casting Issue

    This is Driving me Crazy!
    I have a method that Returns an Object
    Object myconfig = (Object)digester.parse("d:/siteconfig.xml");
    //Now, I always know in this case that the Object being returned
    //is always a "SiteConfig" object.
    //I know this for a fact I test that by doing object.GetClass().getName()
    //and I am looking at the debugger and it says that the object is a "SiteConfig" object
    //However for the life of me, I can not cast this object into a "SiteConifg" object even though it is. I get a ClassCastError Exception when I try to do..
    SiteConfig siteconifg = (SiteConfig)myconfig
    //Can anyone help me out?

    This is the stack trace...
    java.lang.ClassCastException
    at techone.groups.DigesterTest.doPost(DigesterTest.java:69)
    at techone.groups.DigesterTest.doGet(DigesterTest.java:34)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
    at java.lang.Thread.run(Thread.java:536)

  • FileChooser.getSelectedFiles() override and casting issues

    I want to extend the FileChooser class and override its getSelectedFiles method so that it not only returns all selected files, but returns files inside directorys recursively. my code looks like...
    public File[] getSelectedFiles()
    File[] files = super.getSelectedFiles();
    List retVals = new ArrayList();
    for(int i=0; i<files.length; i++)
    if(files.isDirectory())
    retVals.addAll( a recursive function that grabs files from directories and subdirectories );
    else
    retVals.add(files[i]);
    return (File[])retVals.toArray();
    my problem is the return line generates a ClassCastException, which makes sense because File[] is not a descendent of Object[], even though File is a descendent of Object. So what's the work around without alot of hassle? My approach so far seems the best in terms of OO... I'm extending a class and overriding the method I want, and even if I generated a whole new method, there doesn't seem to be a good way to use a List's add-to flexibility and then cast the final result back to an array to return. My hunch is the ultimate way to do this without writing an elaborate data structure is to declare a File[REALLY_BIG_SIZE] to be partially filled and then returned.
    also, in my recursive function i do...
    dir.listFiles(this.getFileFilter())
    and it complains that listFiles() cannot take an operand FileFilter, but there IS a listFiles(FileFilter) function, it's like the editor knows about it, but the debugger doesn't (I'm using Eclipse). any ideas here?

    I want to extend the FileChooser class and override
    its getSelectedFiles method so that it not only
    returns all selected files, but returns files inside
    directorys recursively. my code looks like...
    public File[] getSelectedFiles()
    File[] files = super.getSelectedFiles();
    List retVals = new ArrayList();
    for(int i=0; i<files.length; i++)
    if(files.isDirectory())
    retVals.addAll( a recursive function
    ursive function that grabs files from directories and
    subdirectories );
    else
    retVals.add(files[i]);
    return (File[])retVals.toArray();
    my problem is the return line generates a
    ClassCastException, which makes sense because File[]
    is not a descendent of Object[], even though File is
    a descendent of Object. So what's the work around
    without alot of hassle? My approach so far seems the
    best in terms of OO... I'm extending a class and
    overriding the method I want, and even if I generated
    a whole new method, there doesn't seem to be a good
    way to use a List's add-to flexibility and then cast
    the final result back to an array to return. My
    hunch is the ultimate way to do this without writing
    an elaborate data structure is to declare a
    File[REALLY_BIG_SIZE] to be partially filled and then
    returned.
    also, in my recursive function i do...
    dir.listFiles(this.getFileFilter())
    and it complains that listFiles() cannot take an
    operand FileFilter, but there IS a
    listFiles(FileFilter) function, it's like the editor
    knows about it, but the debugger doesn't (I'm using
    Eclipse). any ideas here?
    change the last line to :
    return (File[]) retVals.toArray(new File[] {});

  • Colour cast issue after OS 'upgrade'

    I recently upgraded(?) to Windows 8.1 and have since discovered that there's a colour cast when I open images in Photoshop or Lightroom, but only on one of my monitors (Wacom Cintiq).
    The images look fine in all other programs on this monitor.
    The images look fine in Photoshop or Lightroom on my other monitor.
    When I move a window containing an image around in Photoshop with my cursor, it shows the appropriate colours while it is moving around but instantly reverts to colour cast when I let go of the mouse.
    I have played with all of the colour settings within Photoshop that I am familiar with, but would be happy for someone to point out a secret colour setting hidden away in fifteen submenus if it'll solve this.
    Here's a visual demonstration, below. I created the 50% grey box (on left) and even converted it to greyscale, yet to the right you can see the colour it appears on my monitor (desktop snapshot at right). If I move that image around with my cursor, it looks like the grey box on the left while moving around and then reverts to the colour cast when I stop. Strange to the extreme.
    The monitor itself shows the appropriate colours (note the background greys of Photoshop are normal).
    It's driving me nuts.
    I give it a day before I find a pre-8.1 back-up of my system and revert to 8.0 forever, unless someone has a solution.
    Thanks in advance.

    Hi twenty_one,
    I calibrate it and profile it. The colours are displaying beautifully.
    ....except in Photoshop. Even then, the background colour in Photoshop is displaying normally, but the colour of the image being manipulated is yellowish (I posted an example above).
    When I drag it around, regardless of whether or not I drag it to the other window, it changes colour immediately, while still on the same monitor. In other words, it isn't changing colours because it is adopting the new monitor profile after I've dropped it, it is changing colours the instant I start moving it.
    I did go through the color management page of the control panel and tried adding a number of new profiles, then switching from one to the other, but I will try again.
    Thanks.

  • Object Casting confusion

    Hello,
    I have two classes used in the insurance business. One is a Member, which is someone covered by insurance (eg. an Employee, Spouse, Dependent) and one is a Employee which is more specificly the person who actually has the insurance.
    I am reading records of a database and creating each record into a Member Object. My Employee object extends Member. I want to know put the business logic in my main method to determine which Members is an Employee, Dependent, or Spouse.
    I am explicitly casting down the hierarchy, which I thought was allowable. I even implemented Cloneable on the Member object to try to get it work. The compiler seems to be fine with it, but I keep getting a runtime error: "ClassCastException".
    I am trying to avoid extracting the information from Member and having to reassemble it into Employee by using inheritance. What am I missing?
    Thanks.
    public class Member implements Cloneable
         private Object ssn;
         private Object planNumber;
         private Object locationCode;
         private Object coverageType;
         private Object benefit;
         private Object hireDate;
         private Object retireDate;
         private Object lastName;
         private Object firstName;
         private Object middleInitial;
         private Object address;
         private Object city;
         private Object state;
         private Object zip;
         private Object dob;
         private Object doh;
         private Object relationship;
         private Object gender;
         private Object effectiveDate;
         private Object status;
         private Object order; //represents order in spreadsheet
         //setters
         public void setOrder(Object order) {this.order = order;}
         public void setSSN(Object ssn){this.ssn = ssn;}
         public void setPlanNumber(Object planNumber){this.planNumber =planNumber;}
         public void setLocationCode(Object locationCode){this.locationCode = locationCode;}
         public void setCoverageType(Object coverageType){this.coverageType=coverageType;}
         public void setBenefit(Object benefit){this.benefit=benefit;}
         public void setHireDate(Object hireDate){this.hireDate=hireDate;}
         public void setRetireDate(Object retireDate){this.retireDate = retireDate;}
         public void setLastName(Object lastName){this.lastName= lastName;}
         public void setFirstName(Object firstName){this.firstName=firstName;}
         public void setMiddleInitial (Object middleInitial){this.middleInitial=middleInitial;}
         public void setAddress(Object address){this.address = address;}
         public void setCity(Object city){this.city = city;}
         public void setState(Object state){this.state = state;}
         public void setZip(Object zip){this.zip=zip;}
         public void setDOB(Object dob){this.dob=dob;}
         public void setDOH(Object doh){this.doh=doh;}
         public void setGender(Object gender){this.gender=gender;}
         public void setEffectiveDate(Object effectiveDate){this.effectiveDate=effectiveDate;}
         public void setStatus(Object status){this.status=status;}
         public void setRelationship(Object relationship){this.relationship = relationship;}
         //getters
         public Object getSSN(){return this.ssn;}
         public Object getPlanNumber(){return this.planNumber;}
         public Object getLocationCode(){return this.locationCode;}
         public Object getCoverageType(){return this.coverageType;}
         public Object getBenefit(){return this.benefit;}
         public Object getHireDate(){return this.hireDate;}
         public Object getRetireDate(){return this.retireDate;}
         public Object getLastName(){return this.lastName;}
         public Object getFirstName(){return this.firstName;}
         public Object getMiddleInitial(){return this.middleInitial;}
         public Object getAddress(){return this.address;}
         public Object getCity(){return this.city;}
         public Object getState(){return this.state;}
         public Object getZip(){return this.zip;}
         public Object getDOB(){return this.dob;}
         public Object getDOH(){return this.doh;}
         public Object getGender(){return this.gender;}
         public Object getEffectiveDate(){return this.effectiveDate;}
         public Object getStatus(){return this.status;}
         public Object getOrder() {return order;}
         public Object getRelationship(){return relationship;}
    }//end class
    import java.util.*;
    public class Employee extends Member
         Employee()
         private Spouse spouse;
         private Dependent dependent;
         private ArrayList dependents;
         private static int numberOfDependents;
         public void setSpouse(Spouse spouse){this.spouse = spouse;}
         public Spouse getSpouse(){return this.spouse;}
         public Dependent getDependent(int n)
              dependent = (Dependent)dependents.get(n);
              return dependent;
         public void setDependent(Dependent dependent)
              ++numberOfDependents;
              this.dependent = dependent;
              this.dependents.add(dependent);
         public ArrayList getDependents()
              return dependents;
         public void setDependents(ArrayList dependents)
              this.dependents = dependents;
         public int getNumberOfDependents()
              return numberOfDependents;
    }//end class
    import java.util.*;
    //Employee objects can be selfstanding Employee(String SSN)
    //The Spouse and Dependent objects - e.g. Spouse(String SSN, e)
    public class InsuranceObjectDriver
    //     ****************** START MAIN **********************************     
         public static void main(String[] args)
              //Open connection and query table
              DatabaseObjects db = new DatabaseObjects("LIBRARY", "", "");     
              db.queryDb("Table1");
              ArrayList memberList = db.getAllRecords();
              Member member;
                   member = (Member)memberList.get(0);
                   if (member.getRelationship().equals("E"))
                        Employee e =(Employee) member;
                   }

    >
    I see nothing wrong with the casting, since Employee
    is a Member.
    My only assumption is that the actual instance of
    "member" is not an Employee...so check your
    getRelationship().equals("E") condition...it may give
    you true, where it should have been false.This is why I'm casting it explicity to a Employee
    For design-wise, I see Employee, Spouse, and
    Dependent are more of a Member role..and not a
    "Member" superclass. I don't understand what you are trying to tell me here. Member is the superclass. Employee, Spouse, and Dependent are subclasses of the Member, which is one of the problems. I have to explicity cast down the hierarchy.
    Plus, what's with all the
    "Object" in the Member class? I never seen anyone
    did this before.
    I understand that by defining the Member attributes
    as Object, you can
    set the underlying type to anything in the
    future...without having to change the code...but i
    think this is a bad idea (just my thought).I like it. It dummy proofs things a bit. The input files are often sloppy and bad, plus I really don't care to maipulate most of these fields, I just need to make sure they populate the objects.
    E.g. I build a quick and dirty application for non-techies, who don't pay attention to data types much (in my many experiences). I don't want the program to bomb out on Date of Hire (doh) because it was brought in through the JDBC connection as an Object and not a Date.
    Data is brought into the application from the resultset via a getObject(n) call. Why change it? I guess I could use wrapper classes for them but I can't see why right now, but will consider this when I figure out the casting issue.

  • CUPC video call issue

                       Hi there,
                                 i am facing the issue ,CUPC 8.5 video call is not working ..i have cucm 8.0. and CUP 8.0 ..any help will be higly appreciated..
    Thanks
    Shib

    Hey Shib,
    For CUPC Desk Phone Troubleshooting, assuming both end points are Personal Communicator Clients, follow the below steps:
    1)  CAST Issue
    For both End Points, make sure that the CAST shows connected under CUPC -> Help -> Show Server Health -> Desk Phone Video Section
    The phone must be connected to the computer on which Cisco Unified Personal Communicator is running by Ethernet cable.
    2) Firmware Issue
    If the end users are controlling 79xx, make sure that the firmware is 9.2(3) or higher. If you are running SCCP9-2-1S, then you will run in the Defect: CSCtq48538    Phone does not send CallStateMessage through CAST connection to PC and have to upgrade the firmware to 9.2(3)
    3) Roles and Permissions
    Besides the Standard CTI Enabled and Standard CCM End User, if the end users are controlling 99xx or 88xx, then make sure they also have these additional Roles and Permissions
    Standard CTI Allow Control of Phones supporting Connected Xfer and conf
    Standard CTI Allow Control of Phones supporting Rollover Mode
    4) Video Enabled
    This setting should be enabled by default, however, make sure that under the Device Configuration Page (CCM Admin -> Device -> Phone -> Affected User's Device
    The PC Port and Video Capabilities fields must be enabled for the phone in Cisco Unified Communications Manager.
    Now if after verifying all of the above configuration the video call fails then I suggest testing CUPC Soft Phone Video by changing to Soft Phone Mode on both the End Points (You can only change to soft phone mode, if you have the Client Services Framework Device deployed for the end users). If that fails as well, I suggest to engage Cisco Tac for further troubleshooting as we would then need to collect the following:
    Clean Detailed PRT from CUPC on both End Points
    Detailed CCM and CTI Traces from Call Manager
    Calling and Called Party Info
    Best Regards,
    Jas

  • TopLink 10 to 11 Migration issue: Expression.in behavior changes:

    Probably old news to to the non-late adopters.
    In TopLink 9 & 10 we sent in Vectors to . I'm having to change them all to arrays using the toArray method.
    Runtime error is:
    java.lang.NoSuchMethodError: oracle.toplink.expressions.Expression.in(java/util/Vector;)Loracle/toplink/expressions/Expression;

    Hello,
    Looks just like a casting issue, as Expression in method was changed to take a Collection instead of just a Vector:
    public Expression in(Collection theObjects)
    I'm surprised you get the error, you may need to recompile with TL11 or cast to Collection.
    Best Regards,
    Chris

  • Query object java method issue

    MyUsernameQuery['userNames'].indexOf('tomjones') will find
    the tomjones
    value in the query.
    BUT:
    MyUsernameQuery['id'].indexOf(99) won't find the numeric
    index value, even
    though it's in the record set.
    BUT WAIT, THERE'S MORE:
    If I manually build a query object with integer values and
    try a similar
    search for the numeric id value,it finds it!
    What's up with that?
    If it was a casting issue, why would it find it in the
    manually built object
    and NOT in the query object?
    I tried casting the integer as a string but no luck.
    I'm in over my head with these methods. Any help much
    appreciated.
    Cheers,
    Lossed
    __when the only tool you have is a hammer, everything looks
    like a nail __

    I should point out that the relative processing speeds are
    dependant upon
    the size of the recordset and position in that recordset of
    the value being
    searching for.
    "Lossed" <[email protected]> wrote in message
    news:eucai4$lhj$[email protected]..
    > It was indeed the casting.
    > I had to cast it as 'long'.
    > There are other ways to find if the value exists:
    > convert column array to list and listfindnocase(), Q of
    Q, loop over
    > query. I was trying to find the fastest. the underlying
    java indexOf()
    > method seems to leave the others in it's dust :).
    >
    > "cf_dev2" <[email protected]> wrote in
    message
    > news:euc51t$epr$[email protected]..
    >>> I'm in over my head with these methods
    >>
    >> Doesn't answer your question, but is indexOf()
    really the only way to get
    >> the
    >> job done? Just wondering if there is an easier way.
    >>
    >> The undocumented stuff is neat, but the java methods
    tend to be stricter
    >> about
    >> object type and case than many of the standard CF
    functions. Two things
    >> may
    >> appear the same but that doesn't mean they are the
    same to java. It can
    >> trip
    >> you up ;)
    >>
    >> That could be the problem with your number column.
    You didn't mention the
    >> column type but some numeric data types don't map to
    a java integer. For
    >> example a biginteger column might map to a java
    long. In which case
    >> searching
    >> for an integer wouldn't work. So it could still be a
    casting
    >> problem
    >>
    >>
    >
    >

  • Serialization, Wrapping, Casting

    Why is serialization useful?
    Why is Wrapping & Casting used?
    Cheers
    RC

    It's people like you who give programmers a bad name.
    Poor sense of humour.
    What tests can you have access to the internet?
    Idiot.Well, pardon me.
    Why is serialization useful?
    Because with it you can deep copy live objects, taking a 'snapshot' if you will of that object ...along with current the values in its data members ...allowing you to do things such as stream it to disk or accross a network where it can be reconstructed 'alive'. It's very useful in things like RMI.
    Why is Wrapping & Casting used?
    Wrapping is when you form a class to hold a primitive datatype, like an int.. You are 'wrapping' the int because, being not an object ...the int can't be serialized and passed over, say, a network. By wrapping it in a class, you have turned the simple int into an object. This object can then be serialized and used as such.
    Now if this isn't homework, my ass!! Plenty of tests allow you to remain online. Those are usiually the ones designed to test your ethics.
    I'll leave the casting issue for now. My show is on.
    Cheers.

Maybe you are looking for

  • Last upgrade killed KDM keyboard/mouse input

    Hi, I performed a pacman -Syu last night and a few packages were upgraded. Now, when I reach the KDM login, it does not detect keyboard or mouse input. However during the boot process it detected the keyboard properly. Of course, now I can't use ctrl

  • Exporting an  interactive quicktime movie to be be used on PC

    I have created a Keynote 06 presentation that is to be interactive. I exported to Quicktime using Sorenson 3 compress, best setting. When I go to watch the presentation it is not interactive. My goal was to create a Keynote presentation that stays on

  • No sound even though sound notifications are turned up

    I have an LG G2.  I have all sound notifications turned up but I am still not getting any sound.  Also bluetooth is turned off so it isn't interfering.  HELP!

  • DB13 scheduled tasks on java databases

    Hi, There are a possibility to connect to an ABAP system one java system for to schedule tasks over DB13? More thanks

  • Lightroom Mobile and RAW-files on iPad's

    Hello, In a Dutch photo magazine called ZOOM.nl I have read, that it is impossible to get RAW-files from a camera (I guess they mean through the SD-card adapter) on an iPad to work with them in Lightroom Mobile!? Is this true? Because on the official