What's wrong with java.util.Date type?

Hi!
When I try to persist object having field of type java.util.Date I get the
following SQL logged by Kodo with subsequent transaction rollback:
2002-11-14 15:03:35,099 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnecti
onFactoryImpl.supportcrm/kodo] INSERT INTO BILLY.TT_COMMENTS(COMMENT_TYPE,
TEXT,
CREATED_BY, ID, SUBJECT, CREATE_DATE, TT_MAIN_ID) VALUES (1, '1', 10, 279,
'1',
{ts '2002-11-14 15:03:35.059'}, 147)
When I change "{ts '2002-11-14 15:03:35.059'}" with "TO_DATE('2002-11-14
15:03', 'YYYY-DD-MM HH24:MI')" in SQL editor
and execute it everything works fine.
What does "{ts '..'}" mean? Is it a SQL generation error?
Thank you in advance.
Best regards,
Alexey Maslov

I've created my own dictionary with dateToSQL() method overridden.
Now it works fine. But it's a kind of strange. Oracle is used often and my
JDBC drivers
are the most recent (at least, from the oracle.com).
Anyway, thank you again.
"Alexey Maslov" <[email protected]> wrote in message
news:[email protected]...
Patric,
Thank you for response.
We're using Oracle 8.1.7 via OCI driver from Oracle 9.2.
I've already tried 2.4.0 and it works fine there but I've found another
problem there
preventing me from using it. See my post in solarmetric.kodo.betanewsgroup.
>
"Patrick Linskey" <[email protected]> wrote in message
news:[email protected]...
That's odd -- what version of Oracle are you using?
Moving to Kodo JDO 2.4.0
(http://www.solarmetric.com/Software/beta/2.4.0) will almost certainly
get rid of this problem, as we use exclusively prepared statements in
it, and therefore pass dates etc. to JDBC as parameters.
But, to get things working with your Oracle database and Kodo JDO 2.3,
you could create your own extension of OracleDictionary and override the
dateToSQL() method to generate the appropriate TO_DATE() syntax. See our
documentation for more details on creating custom database dictionaries.
-Patrick
Alexey Maslov wrote:
I've added TRACE level logging for transactions in JBoss and got
original
exception:
NestedThrowables:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper: [SQL=INSERT
INTO
BILLY.T
T_MAIN(TT_SOLUTION_ID, DELAY_REASON, TT_STATE_ID, ID, CONTACT_PHONE,
CANCEL_REAS
ON, OPER_DESCR, TT_TYPE_ID, CREATED_BY, EXP_CLOSE_DATE,SERV_OPEN_DATE,
OPEN_DAT
E, FLAGS, TAKEN_BY, TT_CAT_ID, SUBJECT_ID, SUBJECT, SERV_CLOSE_DATE)
VALUES
(NUL
L, NULL, 1, 439, NULL, NULL, '____________ ________________ ________________', 7, 5, {ts
'2002-11-14 1
8:38:16.075'}, NULL, {ts '2002-11-14 18:18:16.075'}, 0, NULL, 11,24099,
'1', NU
LL)] ORA-00904: invalid column name
at
com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLEx
ceptions.java:17)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.insert(JDBCSt
oreManager.java:421)
at
com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.insert(D
ataCacheStoreManager.java:265)
at
com.solarmetric.kodo.runtime.StateManagerImpl.insert(StateManagerImpl
..java:1783)
atcom.solarmetric.kodo.runtime.PNewState.flush(PNewState.java:31)
at
com.solarmetric.kodo.runtime.StateManagerImpl.flush(StateManagerImpl.
java:372)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(Persistence
ManagerImpl.java:426)
at
com.solarmetric.kodo.ee.EEPersistenceManager.beforeCompletion(EEPersi
But when I try to execute the statement above against the database
manually
everything works fine.
I'm absolutely desperate!
P.S. On 2.4.0 RC the operation invoking this database insert completes
fine.
"Alexey Maslov" wrote in message
news:[email protected]...
Hi!
When I try to persist object having field of type java.util.Date I
get
the
following SQL logged by Kodo with subsequent transaction rollback:
2002-11-14 15:03:35,099 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnecti
onFactoryImpl.supportcrm/kodo] INSERT INTOBILLY.TT_COMMENTS(COMMENT_TYPE,
TEXT,
CREATED_BY, ID, SUBJECT, CREATE_DATE, TT_MAIN_ID) VALUES (1, '1',
10,
>>>
279,
'1',
{ts '2002-11-14 15:03:35.059'}, 147)
When I change "{ts '2002-11-14 15:03:35.059'}" with
"TO_DATE('2002-11-14
15:03', 'YYYY-DD-MM HH24:MI')" in SQL editor
and execute it everything works fine.
What does "{ts '..'}" mean? Is it a SQL generation error?
Thank you in advance.
Best regards,
Alexey Maslov
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com
Best regards,
Alexey Maslov

Similar Messages

  • What's wrong with java.util.Date??

    Hi all,
    I was just practicing a bit of java.util ,when i was compiling my code-
    import java.util.Date;
    import java.text.SimpleDateFormat;
    class DateStamp{
    public static void Main(String args[]){
    doDate1;
    String D;
    int D1,D2,D3;
    Date dt=new Date();
    SimpleDateFormat sdf=new SimpleDateFormat("dd-mm-yyyy");
    /*When using method .setDate(x) ,is x an integer or String?can x=2/5/2002 or 2-5-2002?*/
    public void doDate1{
    dt.setDay(12);
    dt.setMonth(12);
    dt.setYear(102);
    D=dt.getTime();
    D.parseInt(D1);D=""
    D=sdf.getTime();
    D.parseInt(D2);
    int D3=D2-D1;
    int D3=D3/86400000;/*How do you convert milisec-to-days?*/
    D=D3.toString().
    System.out.println(D+"days have elapsed since then");
    the compiler said this-
    File Compiled...
    --------------------------- Javac Output ---------------------------
    DateStamp.java:7: Invalid expression statement.doDate1;^DateStamp.java:14: Instance variables can't be void: doDate1public void doDate1; ^2 errors
    this problem is persistant, and i'm a java newbie ,Does anyone know what's wrong here?
    Thanks!
    Regards,
    aesh83

    How do you get System date onto a Date variable?Calendar.getInstance().getTime() returns a java.util.Date for the current time. You can also use System.currentTimeMillis() and turn it into a Date.
    Will date.after(Date when) method work when Date
    variables are in milisecs?Date.after(Date when) compares two date objects. As the JavaDoc says "Returns:
    true if and only if the instant represented by this Date object is strictly later than the instant represented by when" To me that says that milliseconds are taken into account, I.E. comparing dates actually compares the date plus the time portion.
    >
    What methods-
    *Convert a date(dd/mm/yy) to milisec?If you look in the javaDoc you'll see "long getTime() Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object." Calendar also has the getTimeInMillis() method.
    *Convert a milisec value to a date(dd/mm/yy)?Calendar.setTimeInMillis(long);
    I'm have this little problem.
    When using GregorianCalander-
    *need to initialize?
    *need set today's date?Calendar.getInstance() will return an appropriate Calendar object for the current locale initialized to the current date/time.
    *how do you check if a date exceeds 3 weeks?I'm not sure what you mean. There are a couple of roll(...) methods that will allow you to add a unit of time to a date. I.E. you could add three weeks to a date.
    To ignore the time portion of a date just set the time to "00:00"
    Col

  • Getting error by ValueBinding with java.util.Date

    Hi.
    1. my english is not so good.
    I develop a JSF-application to learn more about JSF-technologie.
    I use Eclipse 3.2
    Plugins: Web Tools Platform (WTP), Web Standard Tools, Java Server Faces // Version 1.5.0
    JRE: 1.5
    java-impl.jar and java-api.jar (sun)
    Look at this JSP-File Code
    <h:inputText id="dbirth" value="#{dataBean.dbrith}"> </h:inputText>
    this produce an error: EL expression does not evaluate to expected types for this attribute
    dataBean is a ManagedBeain. So if I use any athor variable from this Bean like:
    <h:inputText id="sname" value="#{dataBean.sname}"> </h:inputText>
    is going well. But if I use any java.util.Date variable it produce the error.
    I tried with other Bean and the error is still there.
    I can compile and use this JSP, but this error is there.
    Have any one an idea what is happen there??
    I looked at Eclipse forums, but I didnt found description for an error like this..
    thanks for any help...
    naba
    Message was edited by:
    NamboTango

    The problem is because you have bound the inputText to a java.util.Date object, instead of a String. You must use Strings with inputText. However, JSF has provided a way for you to convert objects into a String. It just needs to know how to do that. Luckily for you, there is a converter already available to convert a Date object into a String. Converters will also take input Strings and convert them into an object.
    So, in your case, use the convertDateTime tag. Like this:
    <h:inputText id="dbirth" value=#{dataBean.dbrith}">
         <f:convertDateTime type="date" pattern="MMM dd, yyyy" />
    </h:outputText>Try it. You may change the pattern to whichever valid one you like.
    CowKing

  • MS Sql + java.util.Date type

    Hi,
    In MySql everything is ok, but in MS Sql I get this error and bouth with timedate type in the database:
    22/11/2006 16:34:59 org.jdesktop.dataset.provider.sql.SQLCommand getUpdateStatement
    WARNING: Problem with update SQL statement null
    22/11/2006 16:34:59 org.jdesktop.dataset.provider.sql.SQLCommand getUpdateStatement
    WARNING: The Java type java.util.Date is not a supported type.
    com.microsoft.sqlserver.jdbc.SQLServerException: The Java type java.util.Date is not a supported type.
    ===========
    My code:
    ===========
    Date newDate = dateReminder.getDate();
    miliSecDate = newDate2.getTime();
    s = spinner.getTime();
    timeStr = s.split(":");
    miliSecTimeS = Long.parseLong(timeStr[1].trim());
    miliSecTime = ((miliSecTimeH * 60 * 60) + (miliSecTimeS * 60)) * 1000;
    newDate2.setTime(miliSecTime + miliSecDate);

    Even if I set myJDatepicker.getDate()
    I get the same error.
    my code:
    GlobalTablesProperties.getInstance().getProvider()
    .getCommand().setParameter("date", myJDatepicker.getDate());
    GlobalTablesProperties.getInstance().getProvider()
    .save(
    GlobalTablesProperties.getInstance().getTaskData());
    JDBCDataConnection jdbcConn = (JDBCDataConnection) (GlobalTablesProperties.getInstance().getProvider().getConnection());
    jdbcConn.commit();
    GlobalTablesProperties.getInstance().getSelectedDataModel()
    .setValue("date", myJDatepicker.getDate());

  • What's wrong with my mobile data network?

    I've had this 2nd hand iPhone 4 for almost 2 months and everything has been working perfectly until today. I was using viber and sending messages to my friends and it suddenly stopped working and i have no idea why, i thought i just lost my 3G for a while so i waited a few hours for it to come back up, this started around 3pm and it's 12am right now and it's still not working... Everything else worked such as skype, twitter and the internet but for some reason i couldnt send and receive messages on viber and imessage. I also didn't get any notifications from ANYTHING during the whole time until i connected to my wi-fi at home which i then got flooded with messages, tweets and etc.
    I think that theres something wrong with my mobile data network and i dont really know what it is since everything was working fine this afternoon and it just suddenly stopped? Connecting to Wi-fi makes everything work fine and i actually receive notifications and am able to send and receive messages to my friends on viber and imessage.
    Can anyone help me?
    My carrier is CSL and it has unlimited data if anyone n

    I havent contacted my carrier and i really dont think they will be able to help since i go to them every month to pay my phone bill and they can barely speak english...
    I've turned my phone on and off 3 times and ive also reseted my network settings

  • What's wrong with Java readline()?

    I just updated to OS X 10.6.8 and installed the Java update 1.6.0_26-b03-384.
    It appears that BufferedReader.readLine() is broken for reading input lines from the console.  readLine() does not terminate with a newline.
    This is pretty basic.  What's up?
    import java.io.*;
              This class demonstrates how to read a line of text from the keyboard
    class ReadLine{
              public static void main(String[] args) throws IOException{
                        String CurLine = ""; // Line read from standard in
                        System.out.println("Enter a line of text (type 'quit' to exit): ");
                        InputStreamReader converter = new InputStreamReader(System.in);
                        BufferedReader in = new BufferedReader(converter);
                        while (!(CurLine.equals("quit"))){
                                  CurLine = in.readLine();
                                  if (!(CurLine.equals("quit"))){
                                            System.out.println("You typed: " + CurLine);

    As it turns out, there's nothing wrong with ReadLine(), the problem was Ant 1.8.2.
    http://issues.apache.org/bugzilla/show_bug.cgi?id=50960
    The Apache distribution is dated late 2010.  The Apple version of 1.8.2 states that it was compiled on June 3, 2011, but if Apple built from the distribution and not from the corrected svn trunk that would explain it.
    My work-around was to install and link ant 1.8.1.

  • What Is Wrong With Java? STILL NOT ANSWERED, PLEASE ANSWER!

    So today (10 PM January 20th), the Firefox Plugin Checker said that my Java version was outdated. I also got a pop-up saying that my current version of Java at the time (Java 7 update 10) had vulnerabilities. So to try and fix this, I went to the Java page and downloaded the update (Java 7 update 11).
    To check and see if my update was working, I went to Java's check page, as well as another page I use. And here I discovered a problem. I got a notification that an old version of Java had been detected, and another prompt to download the current version (which I had already done). So I erased all versions of Java from my control panel, and tried to check it again. And when I did, I got this: http://oi50.tinypic.com/35b6xx2.jpg and http://oi47.tinypic.com/15fg37p.jpg.
    As you can see, both pages tell me that I need to install a missing plugin of some sort. So, thinking this would resolve the issue, I clicked the Install Missing Plugin button. This is what it told me was missing: http://oi45.tinypic.com/302uwbl.jpg. So I clicked next to install it.... and got this: http://oi45.tinypic.com/2cici0x.jpg, which I assume means that the plugin did not install. So I pressed Manual Install... and was lead/linked right back to the Java download page (where it all began, and what doesn't seem to be working in the first place)
    I go to check my plugins again (Just to make sure and also for extra information), and it appears to say that my Java version is current (is that what "Java Deployment Toolkit 7.0.110.21" is? I don't know, I am not good at technology at all. Either way, here is what it looks like: http://oi48.tinypic.com/4kxzz4.jpg). So...if it is current, why is it not working (i.e. I am unable to play games, DO MY COLLEGE CLASSWORK, or play Java-based games)?
    If it helps anything, here is what my control panel looks like in regards to Java right now: http://oi45.tinypic.com/2qlxu9t.jpg Am I missing anything that would make Java work?
    And before anyone says that Java is not essential: It may be that way to you, but I need Java to do classwork for college. Veterinary college.
    So, in short, what is going on with Java, and how can I fix it?
    EDITEDITEDIT: I Have found that I can do my classwork without Java.
    HOWEVER, this DOES NOT mean that the problem is solved or over with. I STILL WANT TO KNOW HOW TO FIX THIS PROBLEM AND GET JAVA TO WORK. Even if I never actually need it, I would still like to have a (working!!!) Java version because of two reasons: 1) I would rather have such a program and not need it, than need such a program and not have it, and 2) aesthetics. Sorry to say, but I am very particular about how things look when it comes to my belongings, and the fact that Java is messing up is making me actually stressed. In short, I still want the above issue solved, even if it's just purely for the sake of Peace Of Mind.

    STILL HAVE NOT GOTTEN A REPLY. PLEASE ANSWER ASAP, AS THIS IS STILL IMPORTANT TO ME. COME ON NOW, I KNOW THAT THERE ARE PEOPLE ONLINE AND ANSWERING QUESTIONS!!

  • How to use  JtextFild with java.util.Date;

    hi
    My problem is that i have a date data type field inaccess in table.
    Otherside i use JTextField.
    First when this window show i initialize this field with current date.
    The code for this is
    lbdate = new JLabel("User Date",JLabel.RIGHT);
              lbdate.setBorder(new EtchedBorder());     
              txtdate = new JTextField();
              txtdate.setBorder(BorderFactory.createLineBorder(Color.red));
              //month convert into string
              int m = cal.get(Calendar.MONTH);
              m++;
              String mon = Integer.toString(m);
              //day convert into string
              int d = cal.get(Calendar.DATE);
              String date = Integer.toString(d);
              //year convert into string
              int y = cal.get(Calendar.YEAR);
              String year = Integer.toString(y);
              txtdate.setText(mon+" / "+date+" / "+year);
    i am not satisfied by this. How can initialize the JtextField by some other method.
    The secound part of question is that how to reterive the date data type of field and see in the textfield.I see butt it returns like this year/month/date(this date is coming from database which already input) 00:00:00
    How can i discard 00:00:00(this time)
    I code for this is
    Date date = rs.Date();
    txtfld.setText(date); //Here error is occured of TypeCasting
    and tell me that how date type object can convert into String for set the text of field
    because JTextField only accept the String data.
    (if u illestrate with code).
    thanks

    Use a JFormattedTextField with a SimpleDateFormat in parameter.
    Denis

  • What's wrong with the new Date()?

    why can't i use as bleow?
    thanks
    System.out.println(new Date());

    Severity and Description     Path     Resource     Location     Creation Time     Id
    Date cannot be resolved to a type     TestClassDate     PrintDate.java     line 5     1156165071640     150

  • What the HELL with java.util.Scanner

    Hello people...
    Somebody have a pointer that teaches how to work with Scanner, or everybody fells like me, as this API just don't work well!!!?
    At this right moment I have the same JAR file, run something at linux and work well, but when at windows got an exception...

    http://java.sun.com/developer/JDCTechTips/2004/tt1201.html
    http://java.sun.com/docs/books/tutorial/essential/io/scanning.html
    ~Tim

  • What's wrong with 8.1.7 export utility

    I was trying to export an Oracle 8.1.6 database by using export
    utility from Oracle 8.1.7 client. But I get a lot of errors.
    When I try to export from Oracle 8.1.6 client everything goes
    smoothly.
    What's wrong with export utility in Oracle 8.1.7 client??
    regards,
    Evan

    It is because for each new version there is more and different
    things that need to be exported so the x+1 exp utility expects
    the new things to be there and fails if they are not.
    The reason I suspect Oracle did this is that most exports are
    done on the server. It is not generaly a good idea to run exp
    across a network for performance reasons (ie you move the entire
    database). As most exports are done on the server the
    comapability is not an issue.most bullet proof solution.

  • 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

  • I'm trying to add the system date with a Label. What is wrong with the code

    import java.util.*;
    import javax.swing.*;
    public class CurrentDateApplet extends JApplet
         Calendar currentCalendar = Calendar.getInstance();
         JLabel dateLabel = new JLabel();
         JPanel mainPanel = new JPanel();
         int dayInteger = currentCalendar.get(Calendar.DATE);
         int monthInteger = currentCalendar.get(Calendar.MONTH)+1;
         int yearInteger = currentCalendar.get(Calendar.YEAR);
         public void init()
              mainPanel.add(dateLabel);
              setContentPane(mainPanel);
              dateLabel.append(currentCalendar.get(Calendar.HOUR) + currentCalendar.get
                        (Calendar.MINUTE);
    }

    As for what's wrong with the code, it would be easier if you said: it doesn't show the date (it does this instead), it doesn't compile (I get this message) etc.
    Anyway I'll assume you want to display the time in a label...
    dateLabel.append(currentCalendar.get(Calendar.HOUR) + currentCalendar.get
    (Calendar.MINUTE);This won't compile: the parentheses are mismatched, and there is simply no such thing as append(). So we could trydateLabel.setText("" + currentCalendar.get(Calendar.HOUR) + currentCalendar.get(Calendar.MINUTE));This wroks, but looks pretty nasty and it's not how you are supposed to format dates and times. Here's the unofficial party line, nicked from one of jverd's posts:
    Calculating Java dates: Take the time to learn how to create and use dates
    Formatting a Date Using a Custom Format
    Parsing a Date Using a Custom Format
    From those links you should be able to find those applicable to times like this: http://www.exampledepot.com/egs/java.text/FormatTime.html
    Using this approach you would end up with something like:import java.text.Format;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import javax.swing.JApplet;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class CurrentDateApplet extends JApplet
        private Date date;
        private JLabel timeLabel;
        private JPanel mainPanel;
        public void init()
            mainPanel = new JPanel();
            timeLabel = new JLabel();
            mainPanel.add(timeLabel);
            setContentPane(mainPanel);
            date = new Date();
            Format formatter = new SimpleDateFormat("HH:ss a");
            timeLabel.setText(formatter.format(date));
    }

  • Error while deploying a web service whose return type is java.util.Date

    Hi
    I have written a simple web service which takes in a date input (java.util.Date) and returns the same date back to the client.
    public interface Ping extends Remote
    * A simple method that pings the server to test the webservice.
    * It sends a datetime to the server which returns the datetime.
    * @param pingDateRequest A datetime sent to the server
    * @returns The original datetime
    public Date ping(Date pingDateRequest) throws RemoteException;
    The generation of the Web service related files goes smoothly in JDeveloper 10g. The problem arises when I try to deploy this web service on the Oracle 10g (10.0.3) OC4J standalone. it gives me the following error on the OC4J console :
    E:\Oracle\oc4j1003\j2ee\home\application-deployments\Sachin-TradingEngineWS-WS\
    WebServices\com\sachin\tradeengine\ws\Ping_Tie.java:57: ping(java.util.Date) in com.sachin.tradeengine.ws.Ping cannot be applied to (java.util.Calendar) _result  = ((com.sachin.tradeengine.ws.Ping) getTarget()).ping
    (myPing_Type.getDate_1());
    ^
    1 error
    04/03/23 17:17:35 Notification ==&gt; Application Deployer for Sachin-TradingEngineWS-WS FAILED: java.lang.InstantiationException: Error compiling :E:\Oracle\oc4j1003\j2ee\home\applications\Sachin-TradingEngineWS-WS\WebServices: Syntax error in source [ 2004-03-23T17:17:35.937GMT+05:30 ]
    I read somewhere that the conversion between java to xml datatype and vice versa fails for java.util.Date, so it is better to use java.util.Calendar. When I change the code to return a java.util.Calendar then the JDeveloper prompts me the following failure:
    Method Ping: the following parameter types do not have an XML Schema mapping and/or serializer specified : java.util.Calendar.
    This forces me to return a String data.
    I would appreciate if someone can help me out.
    Thanks
    Sachin Mathias
    Datamatics Ltd.

    Hi
    I got the web service working with some work around. But I am not sure it this approach would be right and good.
    I started altogether afresh. I did the following step :
    1. Created an Interface (Ping.java) for use in web Service as follows :
    public interface Ping extends Remote{
    public java.util.Date ping(java.util.Date pingDateRequest)
    throws RemoteException;
    2. Implemented the above interface in PingImpl.java as follows :
    public class PingImpl implements Ping
    public java.util.Date ping(java.util.Date pingDateRequest) throws RemoteException {
    System.out.println("PingImpl: ping() return datetime = " + pingDateRequest.toString());
    return pingDateRequest;
    3. Compiled the above 2 java files.
    4. Generated a Stateless Java Web Service with the help of JDeveloper. This time the generation was sucessful.(If I had "java.util.Calendar" in place of "java.util.Date" in the java code of the above mentioned files the web service generation would prompt me for error)
    5. After the generation of Web Service, I made modification to the Ping interface and its implementing class. In both the files I replaced "java.util.Date" with "java.util.Calendar". The modified java will look as follows :
    Ping.Java
    =========
    public interface Ping extends Remote{
    public java.util.Calendar ping(java.util.Calendar pingDateRequest)
    throws RemoteException;
    PingImpl.Java
    ================
    public class PingImpl implements Ping
    public java.util.Calendar ping(java.util.Calendar pingDateRequest) throws RemoteException {
    System.out.println("PingImpl: ping() return datetime = " + pingDateRequest.toString());
    return pingDateRequest;
    6. Now I recompile both the java files.
    7. Withour regenerating the Web Service I deploy the Web Service on OC4j 10.0.3 from JDeveloper. This time the deployment was sucessful.(The Deployment fails if I don't follow the step 5.)
    8. Now I generated a Stub from JDeveloper and accessed the stub from a client. It works fine. Here if you see the Stub code it takes java.util.Date as a parameter and returns a java.util.Date. (Mind you I am accepting a java.util.Calendar and returning the same in my Web Service interface. Step 5)
    The confusing thing is the Serialization and Deserialization of Data from Client java data to Soap message and Soap message to Server java data.
    From Client to SOAP :
    java.util.Date to datetime
    From SOAP to Server :
    datetime to java.util.Calendar
    From Server to SOAP :
    java.util.Calendar to datetime
    From SOAP to Client :
    datetime to java.util.Date (I am not able to understand this part of the conversion)
    Any help or inputs would be appreciated.
    Thanks
    Sachin Mathias

  • What's wrong with my code for comparing date retreived from db and sysdate?

    Hi all,
    I need to retrive date from the DB and compare it to system date.i have posted the code below.i get java.sql.SQL Exception:Io exception:Socket closed.
    What's wrong with the code?please help me.Thanks in advance.
    public boolean date() throws IOException, SQLException {
    Connection con1;
    long millis = System.currentTimeMillis();
    Timestamp timestamp = new java.sql.Timestamp(millis);
    ResultSet rs4 = null;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection(
    "jdbc:oracle:thin:@abc:1605:xyz",
    "cdf", "cdf");
    Statement stmt_exp = con.createStatement();
    rs4 = stmt_exp.executeQuery("SELECT DATE FROM TABLE_NAME")
    while (rs4.next()) {
    Timestamp timestamp2 = rs4.getTimestamp("expire_date");
    con1.close();
    catch (Exception e)
    e.printStackTrace();
    finally
    //ResultSet rs4 = null;
    //Timestamp timestamp2;
    Timestamp timestamp2 = rs4.getTimestamp("expire_date");
    if (timestamp2.compareTo(timestamp) < 0)  //sysdate < exp date
    return true;
    } else {
    return false;
    }

    Didn't you understand what BalusC said? You're closing the connection and then trying to use the ResultSet. The ResultSet will be closed when you close the connection so you can't use it anymore.
    You should close the connection last thing in your code, probably in a finally. And after you close your ResultSet and Statement.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

Maybe you are looking for

  • Dropdownlist in RUEI 12cR2 (12.1.0.3.0) not working correctly

    Hello all, I am using RUEI 12cR2 (12.1.0.3.0) to monitor www.oracle.com and I am unable to view the dropdownbox in the full session replay (FSR). Instead of treating it as a javascript dropdownlist, it shows the following links: http://www.oracle.com

  • TO two step confirmation - return transfers

    Hello, I have set two step confirmation for OT and everything seems ok. I used LT1D for the picking confirmation and LT1E for positioning confirmation. The problems is when in the OT there is a return transfer to a storage type. For example 200 picke

  • On all the time vs standby

    Other than putting it into standby (why would I want to do this) - is there any auto-suspend/standby mode. When I turn my TV on the screen saver is on.... what can/should I do if I dont use my ATV for a few days? -michael

  • Problem: Deploy a web app from a managed server - Can someone answer:  Is this a bug?!

    We're running 6.0sp2 on both AIX and RedHat. Deploying or redeploying a web app to the managed server fails, works fine on the Admin server. War's work fine in the 'applications' dir. The browser fails with a 404 on the managed server, with the follo

  • Puerto rican lover up on you...

    Hey how ya doing today. So tell me something anything.