Java.util.Date  - date range limitations ?

Hi all,
I have a problem when retrieving a Date from a database (java.sql.Date date = resultset.getDate(columnumber)).
When the database field contains a date until 2039-12-31 everything works fine, but when the date is after 2040-01-01, the resultset returns NULL.
Even when I fetch the field as a String (resultset.getString()) or as an Object (resultset.getObject()) the problem remains.
I thought it could have something to do with the fact that a Date object internally holds its state as the number of msec since 1970 - a long - and large dates cannot be kept in this format.
However, in the javadocs, I didn't find any explanation or limitation on the ranges for a date.
What should I do to solve or bypass this problem ?
Thanks !!
Sophie

...msec since 1970 - a long - and large dates cannot be kept in this format.That doesn't have anything to do with it. It stores the time as a long which is 64 bits. So (if my calculations are correct) it should allow for a span of more than 500 million years. That would 250 million years after 1970.
The following gives a year of 33658.
System.out.println("" + new Date(1000000000000000L));
The specified date of "2039-12-31" is highly unusual. One could presume that a boundary condition is causing the problem. Normally dates are calculated from 1/1/1970 00:00:00 (sometimes 1980.) But using a 32 bit integer with seconds as the unit for that gives an expiration in 2038 and it does not fall at the end of the year. Could there be a trigger that is limiting the date field?
It is possible that the cause of your problem is the database or driver (which might consist solely of a jdbc driver or might consist of other parts.) But given the unusual value that you are seeing I wouldn't be surprised if something else is causing it.

Similar Messages

  • Exposing java.util.Map data as RequiredModelMBean

    I'm trying to expose java.util.Map data but I can't quite figure how.
    I'd like the management interface to look like it has an attribute that is actually the key of the map.
    For example, calling:
    mBeanServer.getAttribute(new ObjectName("nomojomofo:type=mapBean"), "fubar");
    would get its data from the target object as:
    aMap.get("fubar");
    Edited by: nomojomofo on Oct 9, 2007 5:31 PM

    You can write a DynamicMBean for that:
    http://weblogs.java.net/blog/emcmanus/archive/2006/11/a_real_example.html
    However you should be aware that most JMX consoles do not expect that the MBeanInfo of a given MBean can change over time.
    If the content of your Map is fixed - you won't have any problem.
    If it can change over time, you might consider exposing the Map as a single attribute,
    for instance, as a CompositeData.
    You might also be interested in this article:
    http://blogs.sun.com/jmxetc/entry/dynamicmbeans%2C_modelmbeans%2C_and_pojos...
    Hope this helps,
    -- daniel
    http://blogs.sun.com/jmxetc

  • Convert java.util.Timestamp to a formatted java.util.date

    Hi,
    I am trying to convert a java.util.TimeStamp date from the DB to a formatted date object. So, how can I convert this TimeStamp into an hourly or daily format that will return me a java.util.Date object? I was trying to convert the TimeStamp using SimpleDateFormat and then parse out to a Date object, but this isn't working. This is what I need
    TimeStamp converted to an "Hourly" date object --> 12:00pm
    TimeStamp converted to a "Monthly" date object --> May

    Hi,
    I am trying to convert a java.util.TimeStamp date
    from the DB to a formatted date object. I don't know what a "formatted date object" is. Do you mean a String?
    So, how can
    I convert this TimeStamp into an hourly or daily
    format that will return me a java.util.Date object?I don't know what you mean when you say "...int an hourly or daily format that will return me a java.util.Date object". A format is a String, are you wanting to parse that into a java.util.Date object?
    I was trying to convert the TimeStamp using
    SimpleDateFormat and then parse out to a Date
    object, but this isn't working. This is what I
    need
    TimeStamp converted to an "Hourly" date object -->
    12:00pmThat's a String then?
    A java.sql.Timestamp extends java.util.Date. So if you've a Timestamp, then you can use it as you would a java.util.Date. If you want a String, then as you say use SimpleDateFormat with the appropriate format string.
    Good Luck
    Lee

  • How do i display 2 amplitudes with unknown range limits

    How do i display 2 amplitude values in graphs with uknown data for range limits. if both could display in the middle of the graph would be great. Any inputs would help me greatly.
    Thank you,
    Ran

    why separate threads for same question. continue here

  • Java.sql.Date vs java.util.Date vs. java.util.Calendar

    All I want to do is create a java.sql.Date subclass which has the Date(String) constructor, some checks for values and a few other additional methods and that avoids deprecation warnings/errors.
    I am trying to write a wrapper for the java.sql.Date class that would allow a user to create a Date object using the methods:
    Date date1 = new Date(2003, 10, 7);ORDate date2 = new Date("2003-10-07");I am creating classes that mimic MySQL (and eventually other databases) column types in order to allow for data checking since MySQL does not force checks or throw errors as, say, Oracle can be set up to do. All the types EXCEPT the Date, Datetime, Timestamp and Time types for MySQL map nicely to and from java.sql.* objects through wrappers of one sort or another.
    Unfortunately, java.sql.Date, java.sql.Timestamp, java.sql.Time are not so friendly and very confusing.
    One of my problems is that new java.sql.Date(int,int,int); and new java.util.Date(int,int,int); are both deprecated, so if I use them, I get deprecation warnings (errors) on compile.
    Example:
    public class Date extends java.sql.Date implements RangedColumn {
      public static final String RANGE = "FROM '1000-01-01' to '8099-12-31'";
      public static final String TYPE = "DATE";
       * Minimum date allowed by <strong>MySQL</strong>. NOTE: This is a MySQL
       * limitation. Java allows dates from '0000-01-01' while MySQL only supports
       * dates from '1000-01-01'.
      public static final Date MIN_DATE = new Date(1000 + 1900,1,1);
       * Maximum date allowed by <strong>Java</strong>. NOTE: This is a Java limitation, not a MySQL
       * limitation. MySQL allows dates up to '9999-12-31' while Java only supports
       * dates to '8099-12-31'.
      public static final Date MAX_DATE = new Date(8099 + 1900,12,31);
      protected int _precision = 0;
      private java.sql.Date _date = null;
      public Date(int year, int month, int date) {
        // Deprecated, so I get deprecation warnings from the next line:
        super(year,month,date);
        if(! isWithinRange(this))
          throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
      public Date(String s) {
        super(0l);
        // Start Cut-and-paste from java.sql.Date.valueOf(String s)
        int year;
        int month;
        int day;
        int firstDash;
        int secondDash;
        if (s == null) throw new java.lang.IllegalArgumentException();
        firstDash = s.indexOf('-');
        secondDash = s.indexOf('-', firstDash+1);
        if ((firstDash > 0) & (secondDash > 0) & (secondDash < s.length()-1)) {
          year = Integer.parseInt(s.substring(0, firstDash)) - 1900;
          month = Integer.parseInt(s.substring(firstDash+1, secondDash)) - 1;
          day = Integer.parseInt(s.substring(secondDash+1));
        } else {
          throw new java.lang.IllegalArgumentException();
        // End Cut-and-paste from java.sql.Date.valueOf(String s)
        // Next three lines are deprecated, causing warnings.
        this.setYear(year);
        this.setMonth(month);
        this.setDate(day);
        if(! isWithinRange(this))
          throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
      public static boolean isWithinRange(Date date) {
        if(date.before(MIN_DATE))
          return false;
        if(date.after(MAX_DATE))
          return false;
        return true;
      public String getRange() { return RANGE; }
      public int getPrecision() { return _precision; }
      public String getType() { return TYPE; }
    }This works well, but it's deprecated. I don't see how I can use a java.util.Calendar object in stead without either essentially re-writing java.sql.Date almost entirely or losing the ability to be able to use java.sql.PreparedStatement.get[set]Date(int pos, java.sql.Date date);
    So at this point, I am at a loss.
    The deprecation documentation for constructor new Date(int,int,int)says "instead use the constructor Date(long date)", which I can't do unless I do a bunch of expensive String -> [Calendar/Date] -> Milliseconds conversions, and then I can't use "super()", so I'm back to re-writing the class again.
    I can't use setters like java.sql.Date.setYear(int) or java.util.setMonth(int) because they are deprecated too: "replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date)". Well GREAT, I can't go from a Date object to a Calendar object, so how am I supposed to use the "Calendar.set(...)" method!?!? From where I'm sitting, this whole Date deprecation thing seems like a step backward not forward, especially in the java.sql.* realm.
    To prove my point, the non-deprecated method java.sql.Date.valueOf(String) USES the DEPRECATED constructor java.util.Date(int,int,int).
    So, how do I create a java.sql.Date subclass which has the Date(String) constructor that avoids deprecation warnings/errors?
    That's all I really want.
    HELP!

    I appreciate your help, but what I was hoping to accomplish was to have two constructors for my java.sql.Date subclass, one that took (int,int,int) and one that took ("yyyy-MM-dd"). From what I gather from your answers, you don't think it's possible. I would have to have a static instantiator method like:public static java.sql.Date createDate (int year, int month, int date) { ... } OR public static java.sql.Date createDate (String dateString) { ... }Is that correct?
    If it is, I have to go back to the drawing board since it breaks my constructor paradigm for all of my 20 or so other MySQL column objects and, well, that's not acceptable, so I might just keep my deprecations for now.
    -G

  • @Embeddable with java.uitil.Date in JPQL (limitations ?)

    I'm facing with problem regarding using java.util.Date in JPQL query.
    Here are sample entities for test case:
    @Embeddable
    public class EmbCompTest implements Serializable{
         private static final long serialVersionUID = 1L;
         @Temporal(TemporalType.DATE)
         private Date beginPeriod;
         @Temporal(TemporalType.DATE)
         private Date endPeriod;
                       // getters and setters goes here (...)
    @Entity
    @Table(name="TEST_DATE")
    @NamedQueries(
       @NamedQuery(name="getByDate",query="select e from TestDate e where e.beginDate=:beginDatePm"),
       @NamedQuery(name="getByDate2",query="select e from TestDate e where e.emb.beginPeriod=:beginPeriodPm")
    public class TestDate {
         private static final long serialVersionUID = 6651720114733319974L;
         @Id
         private Long id;
         @Temporal(TemporalType.DATE)
         private Date beginDate;
         @Temporal(TemporalType.DATE)
         private Date endDate;
         @Embedded
         private EmbCompTest emb;
                         // getters and setters goes here (...)
    The problem is in named query getByDate2 which causes persistence unit fail to start with exception
    Caused by: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Method must not be called with
    argument "java.util.Date" or "java.util.Calendar"
    Is that some SAP JPA limitation that makes unable to query by date defined in @Embeddable classes ?
    Of course query getByDate works fine.
    Best Regards
    Daniel

    Hi Daniel,
    the query getByDate2 is OK and should work. This looks like a bug to me. If you have access to OSS, please file a ticket on BC-JAS-PER-JPA.
    Have you tried typing beginPeriod with java.sql.Date. This might work. (I have not tried).
    -Adrian

  • 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

  • Is there a Java utility class to help with data management in a desktop UI?

    Is there a Java utility class to help with data management in a desktop UI?
    I am writing a UI to configure a network device that will be connected to the serial port of the computer while it is being configured. There is no web server or database for my application. The UI has a large number of fields (50+) spread across 16 tabs. I will write the UI in Java FX. It should run inside the browser when launched, and issue commands to the network device through the serial port. A UI has several input fields spread across tabs and one single Submit button. If a field is edited, and the submit button clicked, it issues a command and sends the new datum to the device, retrieves current value and any errors. so if input field has bad data, it is indicated for example, the field has a red border.
    Is there a standard design pattern or Java utility class to accomplish the frequently encountered, 'generic' parts of this scenario? lazy loading, submitting only what fields changed, displaying what fields have errors etc. (I dont want to reinvent the wheel if it is already there). Otherwise I can write such a class and share it back here if it is useful.
    someone recommended JGoodies Bindings for Swing - will this work well and in FX?

    Many thanks for the reply.
    In the servlet create an Arraylist and in th efor
    loop put the insances of the csqabean in this
    ArrayList. Exit the for loop and then add the
    ArrayList as an attribute to the session.I am making the use of Vector and did the same thing as u mentioned.I am using scriplets...
    >
    In the jsp retrieve the array list from the session
    and in a for loop step through the ArrayList
    retrieving each CourseSectionQABean and displaying.
    You can do this in a scriptlet but should also check
    out the jstl tags.I am able to remove this problem.Thanks again for the suggestion.
    AS

  • Why not Deprecate java.util.Date and java.util.Calendar

    With the introduction of java.time, why did you not flag java.util.Date and java.util.Calendar. These classes have been a bane to every Java developer and should never be used again with the introduction of Java 1.8.

    Adding the @Deprecated annotation would only just provide a warning about an old API and recommendation to the developer(s) to no longer use it. Doing so would not break any existing library out there; in fact quite a number of constructors and methods on the Date class have already been flagged deprecated.
    The new java.time package is far superior to Date/Calendar.

  • How To Add Days into a Date from java.util.Date class

    I have a problem when i wants to add 2 or days into a
    date object geting by java.util.Date class. so please help me resolve this issue?
    for e.g i have a date object having 30/06/2001,
    by adding 2 days i want 02/07/2001 date object ?
    Code
    public class test2
    public static void main(String args[])
    java.util.Date postDate = new java.util.Date();
    myNewDate = postDate /* ?*/;
    Here i want to add 2 date into postDate

    Use Calendar...
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());
    cal.add(Calendar.DAY, 2); // I'm not sure about that "DAY"

  • Java.util.Date

    I have a session bean which is published as a web service. The methods in this bean have a return type of java.util.Date.
    I am unable to invoke any of these web services method in Studio creator. These work fine with a .NET client. The exception is as follows:
    InvocationTargetException com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:451) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100) null sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:445) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Runtime exception; nested exception is: deserialization error: java.lang.NumberFormatException: For input string: "" com.sun.xml.rpc.client.StreamingSender._handleRuntimeExceptionInSend(StreamingSender.java:248) com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:230) webservice.AddDates_Stub.addToDay(AddDates_Stub.java:68) webservice.AddDatesServiceClient.adddatesserviceAddToDay(AddDatesServiceClient.java:19) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:445) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100) deserialization error: java.lang.NumberFormatException: For input string: "" com.sun.xml.rpc.encoding.SimpleTypeSerializer.deserialize(SimpleTypeSerializer.java:142) webservice.Date_SOAPSerializer.doDeserialize(Date_SOAPSerializer.java:60) com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:167) com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:134) webservice.AddDates_AddToDay_ResponseStruct2_SOAPSerializer.doDeserialize(AddDates_AddToDay_ResponseStruct2_SOAPSerializer.java:40) com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:167) com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:134) webservice.AddDates_Stub._deserialize_AddToDay(AddDates_Stub.java:489) webservice.AddDates_Stub._readFirstBodyElement(AddDates_Stub.java:458) com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:158) webservice.AddDates_Stub.addToDay(AddDates_Stub.java:68) webservice.AddDatesServiceClient.adddatesserviceAddToDay(AddDatesServiceClient.java:19) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:445) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

    Hi Meera
    This works fine in creator. I tested with a webservice having a method which returns java.util.date. I used the same code in that method to return java.util.Date. But the same method was returning a Calendar object instead of Date. So I added getTime() method to get the Date.
    Can you post few lines of your code that you are writing in Creator.
    Thanks
    Creator Support

  • Error:Class java.util.date not found

    i have installed 9iAS on my computer.And i want to develop program on JSP.i tried the url below
    http://eyuksel/servlet/IsItWorking
    and i got "it is working" message.when i try to execute my first jsp file i get the error:
    Errors compiling:d:\ias\apache\apache\htdocs\_pages\\_first.java
    d:\ias\apache\apache\htdocs\_pages\_first.java:55: Class java.util.date not found.
    out.print( new java.util.date() );
    ^
    1 error
    what must i do or how can i install the java classes.
    kind regards...
    null

    Thank you very much.It worked:)
    Java is case-sensitive.
    try
    java.util.Date
    instead of
    java.util.date
    null

  • 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

  • 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

  • How can i compare:  java.util.Date oracle.jbo.domain.Date?

    I have made a ViewObject wich contains a date column.
    I want to check if this date is smaller/greater than sysdate:
    i get following error:
    Error(45,24): method <(java.util.Date, oracle.jbo.domain.Date) not found in class Class4
    code:
    SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
    // set up rules for daylight savings time
    pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    // create a GregorianCalendar with the Pacific Daylight time zone
    // and the current date and time
    Calendar calendar = new GregorianCalendar(pdt);
    Date trialTime = new Date();
    calendar.setTime(trialTime);
    (VO_ULNRow)singleRow = null;
    while(vo.hasNext()){                                             // ViewObject vo;
    singleRow = (VO_ULNRow)vo.next();
    if(calendar.getTime() < singleRow.getEO_ULN_BORROWFROM()); //singleRow returns oracle.jbo.domain.Date
    etcetera
    how can i compare those 2?

    Hi,
    oracle.jbo.domain.Date has two methods which suit your needs
    longValue() which returns a long (though I'm not sure if returns a long comparable to the long returned by java.util.Date)
    and dateValue() which returns a java.util.Date
    I hope it helps,
    Giovanni

Maybe you are looking for

  • Using a SDO_FILTER in a JDBC GeoRaster Query

    Hi, I have the following query which works perfectly: http://192.168.33.52:8888/mapviewer/wms?REQUEST=GetMap &SERVICE=WMS &VERSION=1.1.1 &LAYERS= &mvthemes= <themes> <theme name="geor_theme"> <jdbc_georaster_query jdbc_srid="8307" datasource="WMS" ge

  • Group Currency

    Hello, What is the meaning of Group currency ? How it can be changed ? Thanks for your co-operation... SAnjay

  • Disc not supported

    Hi, Total n00b here, so be gentle Recently got a Macbook with Snow Leopard. Initially played movie DVDs fine, but I now receive "disc not supported" error in DVD Player. I have read around the topic a bit, so I have already repaired permissions and c

  • Error: Assignment to feature PINCH did not take place

    Hello I am trying to do initial data entry using PB10, but the system is throwing an error as "Entry B02 does not exist in T526" (B02 is my personal Administrator) which I have maintained in T526 and when I try to continue removing the Pers Officer,

  • Update custom fields when bookin an attendee in TEM

    Hi, this is my case: When I book an attendee in a business event I need to maintain some additional info like e.g. the reason of training, any extra wages,etc, per employee. I have created a custom PD infotype but i can't find a way to maintain it wh