AW: AW: AW: Problem with Date/Time-part

From: René Kulschewski (KU..vu.de)
Date: Thu Feb 24 2005 - 11:27:52 EST

  • Next message: Andrus Adamchik: "Re: Problem with Date/Time-part"

    Hi,

    This is a sample. But the access method doesnt matter IMHO, even if i access
    a object by ObjA.getToObjB() it is the same behaviour.

    -->
    public List findUnprocessed() {

                    String sqlStr = "select id, comdeviceevnmeth_id,
    isacknowledge, comdevice_id, "
                                    + "txdatetime, rxdatetime, gpstime,
    gpslongitude, gpslatitude, "
                                    + "directionofmotion, velocity,
    locationangle, locationdescription, "
                                    + "locationdistance, t.indata.getclobval()
    indata, creation, "
                                    + "creationby, modification, modificationby,
    isdeleted, "
                                    + "comdeviceevnstate_id, tour_id "
                                    + "from comdeviceevent t where
    t.comdeviceevnstate_id=1"
                                    + " order by
    t.comdevice_id,t.txdatetime,t.gpstime";

                    List retval = null;

                    DataContext ctx =
    _SingletonDataContext.getInstance().getCtx();

                    SQLTemplate rsCde = new SQLTemplate(Comdeviceevent.class,
    sqlStr, true);
            
                    retval = ctx.performQuery(rsCde);

                    return retval;
            }

    <--

    Attached you find the class which is returned, and below the relevant part
    from the mapping file:

    <db-entity name="COMDEVICEEVENT">
                    <db-attribute name="COMDEVICEEVNMETH_ID" type="INTEGER"
    length="10"/>
                    <db-attribute name="COMDEVICEEVNSTATE_ID" type="INTEGER"
    length="10"/>
                    <db-attribute name="COMDEVICE_ID" type="INTEGER"
    length="10"/>
                    <db-attribute name="CREATION" type="TIMESTAMP" length="7"/>
                    <db-attribute name="CREATIONBY" type="INTEGER" length="10"/>
                    <db-attribute name="DIRECTIONOFMOTION" type="VARCHAR"
    length="40"/>
                    <db-attribute name="GPSLATITUDE" type="INTEGER" length="10"/>
                    <db-attribute name="GPSLONGITUDE" type="INTEGER"
    length="10"/>
                    <db-attribute name="GPSTIME" type="TIMESTAMP" length="7"/>
                    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true" length="10"/>
                    <db-attribute name="INDATA" type="OTHER" length="2000"/>
                    <db-attribute name="ISACKNOWLEDGE" type="INTEGER"
    length="1"/>
                    <db-attribute name="ISDELETED" type="INTEGER" length="1"/>
                    <db-attribute name="LOCATIONANGLE" type="INTEGER"
    length="10"/>
                    <db-attribute name="LOCATIONDESCRIPTION" type="VARCHAR"
    length="80"/>
                    <db-attribute name="LOCATIONDISTANCE" type="INTEGER"
    length="10"/>
                    <db-attribute name="MODIFICATION" type="TIMESTAMP"
    length="7"/>
                    <db-attribute name="MODIFICATIONBY" type="INTEGER"
    length="10"/>
                    <db-attribute name="RXDATETIME" type="TIMESTAMP" length="7"/>
                    <db-attribute name="TOUR_ID" type="INTEGER" length="10"/>
                    <db-attribute name="TXDATETIME" type="TIMESTAMP" length="7"/>
                    <db-attribute name="VELOCITY" type="INTEGER" length="10"/>
            </db-entity>

    <obj-entity name="Comdeviceevent"
    className="de.ivu.combitour.bo.Comdeviceevent" dbEntityName="COMDEVICEEVENT"
    superClassName="_AbstractDAC">
                    <obj-attribute name="creation" type="java.util.Date"
    db-attribute-path="CREATION"/>
                    <obj-attribute name="creationby" type="java.lang.Integer"
    db-attribute-path="CREATIONBY"/>
                    <obj-attribute name="directionofmotion"
    type="java.lang.String" db-attribute-path="DIRECTIONOFMOTION"/>
                    <obj-attribute name="gpslatitude" type="java.lang.Integer"
    db-attribute-path="GPSLATITUDE"/>
                    <obj-attribute name="gpslongitude" type="java.lang.Integer"
    db-attribute-path="GPSLONGITUDE"/>
                    <obj-attribute name="gpstime" type="java.util.Date"
    db-attribute-path="GPSTIME"/>
                    <obj-attribute name="indata" type="java.lang.String"
    db-attribute-path="INDATA"/>
                    <obj-attribute name="isacknowledge" type="java.lang.Integer"
    db-attribute-path="ISACKNOWLEDGE"/>
                    <obj-attribute name="isdeleted" type="java.lang.Integer"
    db-attribute-path="ISDELETED"/>
                    <obj-attribute name="locationangle" type="java.lang.Integer"
    db-attribute-path="LOCATIONANGLE"/>
                    <obj-attribute name="locationdescription"
    type="java.lang.String" db-attribute-path="LOCATIONDESCRIPTION"/>
                    <obj-attribute name="locationdistance"
    type="java.lang.Integer" db-attribute-path="LOCATIONDISTANCE"/>
                    <obj-attribute name="modification" type="java.util.Date"
    db-attribute-path="MODIFICATION"/>
                    <obj-attribute name="modificationby" type="java.lang.Integer"
    db-attribute-path="MODIFICATIONBY"/>
                    <obj-attribute name="rxdatetime" type="java.util.Date"
    db-attribute-path="RXDATETIME"/>
                    <obj-attribute name="tourId" type="java.lang.Integer"
    db-attribute-path="TOUR_ID"/>
                    <obj-attribute name="txdatetime" type="java.util.Date"
    db-attribute-path="TXDATETIME"/>
                    <obj-attribute name="velocity" type="java.lang.Integer"
    db-attribute-path="VELOCITY"/>
            </obj-entity>

    Thanks for your support !

    Regards
    René

    > -----Ursprüngliche Nachricht-----
    > Von: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > Gesendet: Donnerstag, 24. Februar 2005 16:56
    > An: cayenne-use..bjectstyle.org
    > Betreff: Re: AW: AW: Problem with Date/Time-part
    >
    > Besides this probably shouldn't matter - "types.xml" is not
    > used in runtime.
    >
    > Another question is how do you obtain your objects? Is this a
    > straight SelectQuery on ObjEntity, or is it something else,
    > like SQLTemplate or ProcedureQuery? Sample code?
    >
    > Andrus
    >
    >
    > > I'm using Oracle 9.
    > >
    > >> -----Ursprüngliche Nachricht-----
    > >> Von: Mike Kienenberger [mailto:mkienen..laska.net]
    > >> Gesendet: Donnerstag, 24. Februar 2005 16:47
    > >> An: cayenne-use..bjectstyle.org
    > >> Cc: cayenne-use..bjectstyle.org
    > >> Betreff: Re: AW: Problem with Date/Time-part
    > >>
    > >> Andrus Adamchik <andru..bjectstyle.org> wrote:
    > >> > That's strange ... The original mapping was incorrect. Out of 3
    > >> time-related JDBC types (DATE, TIME, TIMESTAMP), only TIMESTAMP
    > >> provides both date and time portions. So that fix still applies.
    > >> >
    > >> > Not sure what else can be wrong :-/ Are you sure that
    > old *.map.xml
    > >> copy is not sitting somewhere in CLASSPATH?
    > >>
    > >> Also, what version of Oracle are you using?
    > >> Oracle 9 and 10 might need a different extended type mapping.
    > >>
    > >> Index: types.xml
    > >> ==================================================================>
    > >> RCS file:
    > >> /cvsroot/cayenne/cayenne/src/cayenne/java/org/objectstyle/caye
    > >> nne/dba/oracle/types.xml,v
    > >> retrieving revision 1.3
    > >> diff -u -r1.3 types.xml
    > >> --- types.xml 29 Oct 2003 16:58:07 -0000 1.3
    > >> +++ types.xml 24 Feb 2005 15:45:26 -0000
    > >>.. -64,7 +64,7 @@
    > >> <db-type name="DATE"/>
    > >> </jdbc-type>
    > >> <jdbc-type name="TIMESTAMP">
    > >> - <db-type name="DATE"/>
    > >> + <db-type name="TIMESTAMP"/>
    > >> </jdbc-type>
    > >> <jdbc-type name="TINYINT">
    > >> <db-type name="SMALLINT"/>
    > >>
    > >>
    > >> > > Hi,
    > >> > >
    > >> > > No, it does not work :-(. Any idea how to find the problem ?
    > >> > >
    > >> > > Thanks and best regards
    > >> > > René
    > >> > >
    > >> > >> -----Ursprüngliche Nachricht-----
    > >> > >> Von: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > >> > >> Gesendet: Donnerstag, 24. Februar 2005 15:17
    > >> > >> An: René Kulschewski
    > >> > >> Betreff: Re: Problem with Date/Time-part
    > >> > >>
    > >> > >> René,
    > >> > >>
    > >> > >> Just change DATE to TIMESTAMP for DbEntity - this
    > should fix it.
    > >> Hope this helps.
    > >> > >>
    > >> > >> Andrus
    > >> > >>
    > >> > >>
    > >> > >> > Hello,
    > >> > >> >
    > >> > >> > I have a table in Oracle with column of type "Date". In
    > >> > >> this column is
    > >> > >> > a value with Date+Time (checked that with SQLplus).
    > >> > >> > In Cayenne-modeler this column is DATE (DbEntity) and
    > >> > >> java.util.Date
    > >> > >> > (ObjEntity). But when i fetch this value with Cayenne and
    > >> > >> assign it to
    > >> > >> > another variable i get only the "Date"-part, time is
    > >> "00:00:00".
    > >> > >> >
    > >> > >> > Do you have any idea what's wrong ?
    > >>
    >
    >
    >
    >





    This archive was generated by hypermail 2.0.0 : Thu Feb 24 2005 - 11:28:03 EST