How do I return a java.sql.Timestamp data type in a Web service?

I'm new to workshop and java. I'm creating a mini application to simulate a real work Web Service (development environment is on an intranet). I was able to completely simulate the Web Services minus all date values.
I'm using a standard weblogic workshop database controls that are feeding the various WebServices and their methods (Web services was generated from DB control). I get a java type not support error when I attempt to return a java.sql.Timestamp. I temporarily got around the problem by omitting all dates from the sql.
However, we are at the point where we need the complete record.
My two questions
1) What java data type do I convert the java.sql.Timestamp to
2) Where and how do I do it in workshop.
Thanks in advance
Derrick
Source view from workshop looks something like this.
public interface MyData extends DatabaseControl, com.bea.control.ControlExtension
static public class dbOverallRec
public String key;
public String field1;
public int field2;
public java.sql.Timestamp create_date
public dbOverallRec () {};
*@jc:sq; rowset-name="OverallRowSet" statement::
*select key, field1, field2 ,create_date from overall where key={KEY}::
dbOverallRec getOverallByKey(String Key);
* I had to omit the create_date to get it to work

You should try changing java.sql.Timestamp to java.util.Calendar.
java.util.Calendar maps to the dateTime type in XML Schema, and TIMESTAMP as a JDBC type.
Regards,
Mike Wooten

Similar Messages

  • How to get java.sql.Timestamp data from database

    Hello, i'm new to EJB and i can't get java.sql.Timestamp data, but when i'm trying to get java.lang.String data it works fine.
    * @ejb.finder
    * query="SELECT OBJECT(c) FROM userSCHEMA AS c
    *      WHERE c.lastName LIKE ?1
    * AND c.firstName LIKE ?2
    * AND c.registeredDate < ?3"
    * signature="java.util.Collection findPatient * (java.lang.String lastName,
    * java.lang.String firstName,
    * java.sql.Timestamp)"
    <method-params>
    <method-param>java.lang.String</method-param>
    <method-param>java.lang.String</method-param>
    <method-param>java.sql.Timestamp</method-param>
    </method-params>
    Where i made a mistake ?

    The main problem that I'm faced with, is that the
    java.sql.Timestamp now has only one constructor, it
    takes "long", i.e., milliseconds.That's because a Timestamp is just an offset from a particular instant of time. It doesn't have a timezone.
    Please note that I'm not trying to "print", i.e., I'm
    not interested in using the SimpleDateFormat.Then what are you interested in? You appear to be trying to create a Timestamp with a particular timezone, which doesn't make sense as I already noted. Is there a reason for this?

  • How to reference complex data type when consuming web services in WAS 620?

    In WAS 620, I tried to consume a web service in ABAP. I was successful when the web service returned one or more simple data type. But when the web service is changed to return a complex data type (eg. a structure with 3 elements), the call to the web service did not return anything.
    Do any of you know how to reference the individual element in the structure of an output parameter in a web service? I use the add_parameter method of the CSoapDocument class to identify the output parameters.
    Here is part of the WSDL file:
      <?xml version="1.0" encoding="UTF-8" ?>
    - <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:s0="urn:sap-com:document:sap:rfc:functions" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="urn:sap-com:document:sap:rfc:functions">
    - <types>
    - <xsd:schema targetNamespace="urn:sap-com:document:sap:rfc:functions">
    - <xsd:element name="Z_SRM_SOAP_TEST_COMPLEX">
    - <xsd:complexType>
    - <xsd:all>
    - <xsd:element name="INTEXT">
    - <xsd:simpleType>
    - <xsd:restriction base="xsd:string">
      <xsd:maxLength value="50" />
      </xsd:restriction>
      </xsd:simpleType>
      </xsd:element>
      </xsd:all>
      </xsd:complexType>
      </xsd:element>
    - <xsd:element name="Z_SRM_SOAP_TEST_COMPLEX.Response">
    - <xsd:complexType>
    - <xsd:all>
      <xsd:element name="OUTTEXT" type="s0:ZSRM_TEST_STRUCT" />
      </xsd:all>
      </xsd:complexType>
      </xsd:element>
    - <xsd:complexType name="ZSRM_TEST_STRUCT">
    - <xsd:sequence>
    - <xsd:element name="ELEMENT1" minOccurs="0">
    - <xsd:simpleType>
    - <xsd:restriction base="xsd:string">
      <xsd:maxLength value="50" />
      </xsd:restriction>
      </xsd:simpleType>
      </xsd:element>
    - <xsd:element name="ELEMENT2" minOccurs="0">
    - <xsd:simpleType>
    - <xsd:restriction base="xsd:string">
      <xsd:maxLength value="50" />
      </xsd:restriction>
      </xsd:simpleType>
      </xsd:element>
    - <xsd:element name="ELEMENT3" minOccurs="0">
    - <xsd:simpleType>
    - <xsd:restriction base="xsd:string">
      <xsd:maxLength value="50" />
      </xsd:restriction>
      </xsd:simpleType>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:schema>
      </types>

    Hi,
      [email protected] is my id and one more thing u by looking at the wsdl file u can know what al the parameters we have to give to the webservice so try it out also.
    Regards,
    Sirisha.

  • Java.sql.Timestamp creation with value -4712.01.01 (oracle min timestamp)

    How can I create ajava.sql.Timestamp with the value -4712.01.01?
    Trying Timestamp timestamp = new Timestamp( -210863523208000l );leads to the date 4713-02-08 00:06:32.0.
    Or what is the minimal java.sql.timestamp value in Java?
    Edited by: bejq on 17.03.2009 08:56

    bejq wrote:
    Thanks for your quick answer.
    Yes it is 1st January 4712 BC.
    Timestamp timestamp = new Timestamp( -4712, 1, 1, 0, 0, 0, 000 );//deprecated Method
    System.out.println( timestamp ); // returns 2813-02-01 00:00:00.0
    System.out.println( timestamp.getTime() );// returns -150904688400000Thats not what I want.You have lost me then. Unless of course you want to use SimpleDateFormat with an appropriate TZ to parse the date to a java.util.Date and then construct a java.sql.Timestamp from the java.util.Date using the java.util.Date#getTime() method to construct the java.sql.Timestamp .
    Edited by: sabre150 on Mar 17, 2009 10:41 AM

  • Problem saving java.sql.timestamp

    I am using java.sql.timestamps for all date fields inside the database.
    the client program is using a session bean to insert the data into the database. Afterwards when I do a select in sql plus the date is always 2 hours and 30 minutes above the value I supplied to the database.
    Are there any timezone settings I have to supply on the server ?
    thx in advance
    null

    Please shrink your code down to the bare minimum that compiles and demonstrates the problem. Do not include any tests that pass. Just the one that fails, and describe clearly exactly how it fails--what's expected and what is observed instead.
    You can probably even get rid of the separate test class and just put it all in main, or at least all in the same class with main and one or a small handful of other methods.

  • EJBQL, MIN and java.sql.Timestamp

    I am trying to create a new finder method for a cmp bean which returns me the date of the oldest bean available.
    the ejbql query looks like this:
    select MIN (a.receiveDate) from AssetSchema as a
    receiveDate is defined as a java.sql.Timestamp field in the bean. I am getting the following error:
    Bean: Asset
    Method: clover.AssetLocal findOldestDeleted()
    EJBQL: select MIN (a.receiveDate) from AssetSchema as a
    Error: JDO75334: Invalid type 'java.sql.Timestamp' of select clause expression for finder method.
    anything wrong with the query or .....

    Instead of using a finder, use an ejbSelect method. You can then use the aggregate function MIN. Wrap the ejbSelect in a home method.
    In remote Home interface, define home method:
    public java.lang.String selectMinSingle() throws RemoteException;
    define the ejbSelect method in EJB class:
    public abstract java.lang.String ejbSelectMinSingle() throws FinderException;
    The ejbSelect is wrapped in a ejbHome method:
    public java.lang.String ejbHomeSelectMinSingle()
    try {
    String s = ejbSelectMinSingle();
    return s;
    } catch(Exception e) {
    throw new EJBException("ejbHomeSelectMinSingle: " + e);
    Call home method from client:
    String s1 = beanHome.selectMinSingle();
    Not sure if this is what you're looking to do.
    There is also the ORDER BY clause; i.e.,
    <ejb-ql>Select p.quantity from ProductBean p ORDER BY p.quantity</ejb-ql>
    use the ASC or DESC keyword:
    <ejb-ql>Select p.quantity from ProductBean p ORDER BY p.quantity ASC</ejb-ql>
    For finder:
    query>
    <description></description>
    <query-method>
    <method-name>findProductsByHighestQuantity</method-name>
    <method-params />
    </query-method>
    <ejb-ql>Select DISTINCT OBJECT(p) From ProductBean p ORDER BY p.quantity DESC</ejb-ql>

  • About java.sql.Timestamp

    How to add 3 hours to the time that store in java.sql.Timestamp by not using the deprecated API?

    See java.util.Calendar.html#setTime(java.util.Date)
    Moreover, java.sql.Timestamp extends java.util.Date

  • Java.sql.Timestamp and the Epoch

    Hello all
    according to the JavaDoc for Timestamp, the long parameter of the constructor represents "milliseconds since January 1, 1970, 00:00:00 GMT". However, running
    class Main
      public static void main (String [] args)
        System.out.println (new java.sql.Timestamp (0l));
    } produces 1970-01-01 01:00:00.0, which is 3.6 million ms since the time stated in the doc.
    My box is set to GMT. Does anyone know of an explanation for this?
    Cheers

    I'd say that extra hour is the daylight savings hour.
    The GMT timezone uses it, but UTC ( Universal time coordinates ) doesn't.
    regards,
    Owen

  • Java.util.Date badly serialized to java.sql.Timestamp Coherence 3.5.2

    Hi all,
    I'm running into this odd behaviour.
    I serialize java.util.Date objects to cache and when I read them back from cache, they appear to be java.sql.Timestamp types.
    I've isolated a junit test for that.
    Do you know why Coherence changes the type in the middle?
    Regards
    Harry.
    import java.util.Date;
    import org.junit.Assert;
    import org.junit.Test;
    import com.tangosol.io.Serializer;
    import com.tangosol.io.pof.ConfigurablePofContext;
    import com.tangosol.util.ExternalizableHelper;
    public class DatePofSerialTest {
         @Test
         public void testCobdate() throws Exception {
              Date date=new Date();
              Serializer serial = new ConfigurablePofContext();//"coherence-pof-config.xml");
              Date date2=(Date)ExternalizableHelper.fromBinary(ExternalizableHelper.toBinary(date, serial), serial);
              System.out.println(serial +" -- Date to serailize ["+ date.getClass() + "]");
              System.out.println(serial +" -- Date from deserialize ["+ date2.getClass() + "]");
              Assert.assertEquals(date, date2);/* Of course this passes, as both refer to the same time (long)*/
    {code}
    This gives as output
    {code:title=output |borderStyle=solid}
    log4j:WARN No appenders could be found for logger (Coherence).
    log4j:WARN Please initialize the log4j system properly.
    com.tangosol.io.pof.ConfigurablePofContext {location=coherence-pof-config.xml} -- Date to serailize [class java.util.Date]
    com.tangosol.io.pof.ConfigurablePofContext {location=coherence-pof-config.xml} -- Date from deserialize [class java.sql.Timestamp]
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi Harry,
    It looks like the same issue as ...
    PofExtractor with java.util.Date results in ClassCastException
    It was fixed in version 3.5.4.
    Thanks

  • A silly question about oracle.sql.timestamp and java.sql.timestamp

    Hi,
    I'm looking at a method that takes objects of type Object and does stuff if the object is really a java.sql.timestamp. If it is not then an error is flagged. In my case it flags an error when an object of type oracle.sql.timestamp is passed to it. Not really entirely comfortable with java (i'm still learning it), here's my stupid question :- why isn't oracle.sql.timestamp a subclass of java.sql.timestamp? Also in various books it indicates that java.sql.timestamp maps to oracle.sql.timestamp. Does that mean you have to physically do the mapping:
    i.e.
    java.sql.Timestamp t = new Timestamp( new oracle.sql.Timestamp( CURRENTTIMESTAMP ).timestampValue() );
    or is there something else to it.
    Thanks.
    Harold.

    The best forum for this is probably Forum Home » Java » SQLJ/JDBC
    Presumably you are refering to oracle.sql.TIMESTAMP. While this is intended to (and does) correspond to java.sql.Timestamp it can't be a subclass because it needs to be a subclass of oracle.sql.Datum.

  • Usage of java.sql.Timestamp with classes12.zip and ojdbc14.jar  ?

    Hi all,
    If i'm using java.sql.Timestamp with classes12 it is functioning perfectly,
    if i'm using ojdbc14 and java.sql.Timestamp it is functioning in different way and failing to do the action..
    Example : update set xxx=yy where time = my Timestamp object set in Prepared statement
    Hope to see the answer

    http://forum.java.sun.com/thread.jspa?threadID=460615&messageID=2116517
    Timestamp insert problem
    Using the "classes12.zip" file that comes with the distribution for Oracle versions 8.1.6.x and 8.1.7.x, Oracle's DATE datatype is mapped to the "java.sql.Timestamp" class. However, the "ojdbc14.jar" driver maps DATE to "java.sql.Date", and "java.sql.Date" only holds a date (without a time), whereas "java.sql.Timestamp" holds both a date and a time.

  • Convert java.sql.Timestamp to java.util.Calendar?

    What's the best way to convert java.sql.Timestamp to java.util.Calendar?

    Use Calendar's setTime(Date date) method.
    java.sql.Timestamp extends java.util.Date.
    -Roy

  • Can I use ' ', ' ', '= ' and ' =' with java.sql.Timestamp objects in EJB-QL

    ie. Is this valid?
    <query>
    <description>Find data between dates</description>
    <query-method>
    <method-name>findMetricsByDate</method-name>
    <method-params>
    <method-param>java.sql.Timestamp</method-param>
    </method-params>
    <method-params>
    <method-param>java.sql.Timestamp</method-param>
    </method-params>
    </query-method>
    <result-type-mapping>Local</result-type-mapping>
    <ejb-ql>
    SELECT OBJECT (o) FROM MetricResults AS o WHERE MetricResults.date > ?1 AND MetricResults.date < ?2
    </ejb-ql>
    </query>

    No. Not with current EJB 2.0 CMP specs at least. Later revisions are supposed to fix this, but for now, this seriously limits the usefulness of EJB-QL.
    .P.

  • Java.sql.Timestamp: does not have a no-arg default constructor ERROR

    Hi,
    I am using jaxws(jwsdp2.0) and when i use the apt tool I get this error because I use java.sql.Timestamp as one of the fields in a class. What is the workaround for this problem? Any help is appreciated.
    Thanks,
    Vijay

    I just replaced java.sql.Timestamp to java.util.Date for this to work.
    Any other workaround is welcome.
    Vijay

  • Map java.sql.Timestamp to JDBC-MySQL TIMESTAMP?

    Java provides the java.sql.Timestamp class specifically to be able to make
    use of the greater-accuracy timestamps provided in JDBC and underlying
    datastores. Is there a way to set up a Kodo mapping file such that a
    persistent class with a java.sql.Timestamp field, has this field map to a
    TIMESTAMP field in the underlying database table?
    Thanks,
    -- Bryan

    Yes, with a custom field mapping. See the example of a custom field
    mapping for java.sql.Date in samples/ormapping. A mapping for timestamp
    would be almost exactly the same.

Maybe you are looking for

  • Hi, I am new to Applescript and after messing around with it have a few questions.

    Firstly, I love applescript so far and have made an alarm clock, simple get weather app and applescript app that announces the time and date. i would like to be able to use this as a jarvis like combined app where i can have all of these built into o

  • Problems syncing with iTunes after upgrading to OS5

    Hello, After upgrading my iPod 3G software to OS5, when I plug my iPod into my Mac (OS10.6.8), iTunes (v10.5) will freeze for several minutes before it can be used again. When I sync my iPod, iTunes will sync all my video podcasts to the iPod, even t

  • Can't connect to iTunes from my iPod Touch or from my Computer!!

    Since yesterday, I have been having trouble connecting to the iTunes store from my iPod and computer. I can search for apps and whatever on both devices, but when it comes time to download them, on the iPod it just says "Waiting.." for a while, then

  • DVD player doesn't work correctly

    I have a Toshiba Satellite L300 laptop. It's pretty new - bought in the summer. The operating system is Windows Vista.  I have a problem with my DVD player. It often just stops working. It sometimes works after I restart the computer, but for short p

  • Flex mobile orientation: force portrait mode and then allow auto orientation

    I'm creating a flex mobile project and I want to force the app to portrait orientation when I click a button, and when I click other button allow again to change the orientation. This is my code when I click the first button, where I want to force po