Timezone in Java Date

Hi,
Our application takes the system Date along with current time in PST/MST/CST timezone & serializes the same & send to webmethods. Webmethods sends the serialized object to JMS queue on weblogic server (This weblogic server is in EST). We have a MDB running on weblogic server which gets the message from JMS queue. When I print the Date/Time from this, I get the date/time in EST timezone. Same is inserted in my DB. I want to preserve the value what is coming from webmethods. I guess, my weblogic server is running in EST, it is putting the default time zone of this JVM.
E.g: My application in CST/PST/MST timezone sends the date as 7/18/2006 8.00:00 AM CST to webmethods. In MDB ( which is in EST) , i see the date a 7/18/2006 9.00:00 AM EST
Can anybody tell me how can I preserve the timezone when date moves across timezone.
TIA
Ashish

Perhaps u did not get my point. As the time captured
in CST gets converted to EST, when the user sees the
same over web application, he sees the time in EST,
which is misleading.
If someone punchIn for daily job at 8.00am CST, he
would not like to see timecard from 9.00am EST.You do not get the point yet. You are trying to solve this in a backwards fashion. Keep the time stored exactly as it is. Then adjust the display (with the timezone) based on the users settings.
So when the user in CST looks at it they see CST when an EST looks at it they see EST. But store it all with the one. Storage and display are two different things and you need to grasp this very important point.

Similar Messages

  • How to set the timezone in a DATE datetype?

    How to set the timezone in a DATE datetype?
    Thanks
    Maximus

    10.5 Date, Time, and Timestamp
    The JDBC API follows the Java platform's approach of representing dates and times as a millisecond value relative to January 1, 1970 00:00:00 GMT. Since most databases don't support the notion of a time zone, the JDBC 2.0 API adds new methods to allow a JDBC driver to get/set Date, Time, and Timestamp values for a particular time zone using a Calendar. For example,
    ResultSet rs;
    Date date1 = rs.getDate(1);
    returns a Date object that wraps a millisecond value which denotes a particular date, like January 3, 1999, and a normalized time 00:00:00 in the default time zone. The time component of the Date is set to zero in the default time zone since SQL DATE values don't have a time component. Since a Calendar was not supplied explicitly to getDate() , the default time zone (really the default Calendar) is used by the JDBC driver internally to create the appropriate millisecond value assuming that the underlying database doesn't store time zone information.
    The following example retrieves a date value in GMT-Greenwich Mean Time.
    ResultSet rs;
    TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
    Calendar cal = Calendar.getInstance();
    Date date2 = rs.getDate(1, cal);
    In the example above, a Calendar is passed explicitly to getDate() to inform the JDBC driver how to calculate the appropriate millisecond value. Note that the same result could have been achieved by simply changing the default time zone, and not passing the Calendar explicitly since the JDBC driver will use the default time zone by default.
    Note that the two Date objects created above will not compare as equal assuming that the default time zone is not GMT, even if they represent the `same' date.
    if (date1.equals(date2))
    //never get here
    This is because each Java language Date object really just wraps a normalized millisecond time value and these millisecond values will differ across time zones. If an application wishes to compare dates in different time zones it should first convert them to a Calendar.
    An application should create a Date object using a Calendar. The application is responsible for specifying the time as 00:00:00 on the desired date when using the Calendar since JDBC uses this convention. In addition when creating a Time value the application must specify a date of January 1, 1970 to the Calendar used to create the millisecond value for the Time as this is the convention specified by JDBC for time.
    Above from:
    http://java.sun.com/products//jdk/1.2/docs/guide/jdbc/spec2/jdbc2.0.frame10.html
    I hope it can help you!

  • Unfortunately Java Dates

    I am new to Java, I took one class last semester using Eclipse. I have a program that is driven off an access data base. In the data base the dates are a date/time type formatted mm/dd/yy. We did not work with dates as a rule but I used them so would get the experience. How do I change the format in my GUIs so the date is not yyyyMMdd, but the same as the data base.

    Still here and still somewhat confused. I have the sdf so I can format the dates the way I want but have no idea what t do with them now. One is a birthdate that belongs to the Problem Domain Class Players. The other I want to be a serial date set to 08/01/current year. This is what I have so far:
    package Main;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.TimeZone;
    * @author barker44
    public class DateTest {
         public static void main(String[] args) {
              Calendar aCalendar = Calendar.getInstance(TimeZone.getDefault());
              java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MM/dd/yyyy");
              String strThisSeason = sdf.format(aCalendar.getTime());
              Date datThisSeason = null;
              // This is a format for jtxtCurrentSeason in the clsPlayersGUI
              // It is separate from the the player class and is only used in the GUI
              // It will be a serial date automatically set to Aug 1 of the current season
              // If I can figure out how to set it in the GUI
              String strCurrentSeason = "08012006";
              SimpleDateFormat sdf1 = new SimpleDateFormat("MMddyyyy");
              SimpleDateFormat sdf2 = new SimpleDateFormat("MM/dd/yyyy");
              Date datCurrentSeason = null;
              // This is a format for jtxtDOB in the clsPlayersGUI
              // Have to figure out where it should be implemented
              // In the PDC or in the GUI
              String strDateOfBirth = "12011995";
              SimpleDateFormat sdf3 = new SimpleDateFormat("MMddyyyy");
              SimpleDateFormat sdf4 = new SimpleDateFormat("MM/dd/yyyy");
              Date datDOB = null;
              try {
                   datThisSeason = sdf.parse(strThisSeason);
                   datCurrentSeason = sdf1.parse(strCurrentSeason);
                   datDOB = sdf3.parse(strDateOfBirth);
              } catch (ParseException e) {
                   e.printStackTrace();
              System.out.println("This Season = " + sdf.format(datThisSeason));
              System.out.println("Current Season = " + sdf2.format(datCurrentSeason));
              System.out.println("Date of Birth = " + sdf4.format(datDOB));
         }The first is not what I want because it sets the current month, day, year. But the others are formatted like I want I just don't know what to do with them. In my GUI I created a setCurrentDate method to set the text box to the current date but it doesn't work. Like I said I have this in VBA but can't figure out what to do with it here.
    This is what happns when a 48 year old ex-carpenter goes back to school to learn coding. In case you are wondering I am a student at Morrisville State College in central NY and I am working on my bachelors in Application Software, the semester is over and I am just trying to improve on what I learned this past semester.
    So any additional help would be greatly appreciated.
    Thanks.

  • How to do sorting/filtering on custom java data source implementation

    Hi,
    I have an entity driven view object whose data should be retrieved and populated using custom java data source implementation. I've done the same as said in document. I understand that Query mode should be the default one (i.e. database tables) and createRowFromResultSet will be called as many times as it needs based on the no. of data retrieved from service, provided we should write the logic for hasNextForCollection(). Implementation sample code is given below.
    protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams) {      
    Iterator datumItr = retrieveDataFromService(qc, params);
    setUserDataForCollection(qc, datumItr);
    hasNextForCollection(qc);
    super.executeQueryForCollection(qc, params, noUserParams);
    protected boolean hasNextForCollection(Object qc) {
    Iterator datumItr = (Iterator) getUserDataForCollection(qc);
    if (datumItr != null && datumItr.hasNext()){
    return true;
    setCallService(false);
    setFetchCompleteForCollection(qc, true);
    return false;
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet resultSet) {
    Iterator datumItr = (Iterator) getUserDataForCollection(qc);
    Object datumObj = datumItr.next();
    ViewRowImpl r = createNewRowForCollection(qc);
    return r;
    Everything is working fine include table sorting/filtering. Then i noticed that everytime when user perform sorting/filtering, executeQueryForCollection is called, which in turn calls my service. It is a performance issue. I want to avoid. So i did some modification in the implementation in such a way that, service call will happen only if the callService flag is set to true, followed by executeQuery(). Code is given below.
    private boolean callService = false;
    public void setCallService(boolean callService){
    this.callService = callService;
    public boolean isCallService(){
    return callService;
    protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams){
    if (callService)
    Iterator datumItr = retrieveDataFromService(qc, params);
    setUserDataForCollection(qc, datumItr);
    hasNextForCollection(qc);
    super.executeQueryForCollection(qc, params, noUserParams);
    Issue i have:
    When user attempts to use table sort/filter, since i skipped the service call and set null as userDataCollection, createRowFromResultSet is not called and data which i retrieved and populated to view object is totally got vanished!!. I've already retrived data and created row from result set. Why it should get vanished? Don't know why.
    Tried solution:
    I came to know that query mode should be set to Scan_Entity_Cache for filtering and Scan_View_Rows for sorting. I din't disturb the implementation (i.e. skipping service call) but overrided the executeQuery and did like the following code.
    @Override
    public void executeQuery(){
    setQueryMode(callService ? ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES : ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS);
    super.executeQuery();
    By doing this, i could able to do table filtering but when i try to use table sorting or programmatic sorting, sorting is not at all applied.
    I changed the code like beolw*
    @Override
    public void executeQuery(){
    setQueryMode(callService ? ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES : ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
    super.executeQuery();
    Now sorting is working fine but filtering is not working in an expected way because Scan_View_rows will do further filtering of view rows.
    Question:
    I don't know how to achieve both filtering and sorting as well as skipping of service call too.
    Can anyone help on this?? Thanks in advance.
    Raguraman

    Hi,
    I have an entity driven view object whose data should be retrieved and populated using custom java data source implementation. I've done the same as said in document. I understand that Query mode should be the default one (i.e. database tables) and createRowFromResultSet will be called as many times as it needs based on the no. of data retrieved from service, provided we should write the logic for hasNextForCollection(). Implementation sample code is given below.
    protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams) {
      Iterator datumItr = retrieveDataFromService(qc, params);
      setUserDataForCollection(qc, datumItr);
      hasNextForCollection(qc);
      super.executeQueryForCollection(qc, params, noUserParams);
    protected boolean hasNextForCollection(Object qc) {
      Iterator datumItr = (Iterator) getUserDataForCollection(qc);
      if (datumItr != null && datumItr.hasNext()){
        return true;
      setFetchCompleteForCollection(qc, true);
      return false;
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet resultSet) {
      Iterator datumItr = (Iterator) getUserDataForCollection(qc);
      Object datumObj = datumItr.next();
      ViewRowImpl r = createNewRowForCollection(qc);
      return r;
    }Everything is working fine include table sorting/filtering. Then i noticed that everytime when user perform sorting/filtering, executeQueryForCollection is called, which in turn calls my service. It is a performance issue. I want to avoid. So i did some modification in the implementation in such a way that, service call will happen only if the callService flag is set to true, followed by executeQuery(). Code is given below.
    private boolean callService = false;
    public void setCallService(boolean callService){
      this.callService = callService;
    public boolean isCallService(){
      return callService;
    protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams){
      if (callService) {
        Iterator datumItr = retrieveDataFromService(qc, params);
        setUserDataForCollection(qc, datumItr);
      hasNextForCollection(qc);
      super.executeQueryForCollection(qc, params, noUserParams);
    }Issue i have:
    When user attempts to use table sort/filter, since i skipped the service call and storing of userDataCollection, createRowFromResultSet is not called and data which i retrieved and populated to view object is totally got vanished!!. I've already retrived data and created row from result set. Why it should get vanished? Don't know why.
    Tried solution:
    I came to know that query mode should be set to Scan_Entity_Cache for filtering and Scan_View_Rows for sorting. I din't disturb the implementation (i.e. skipping service call) but overrided the executeQuery and did like the following code.
    @Override
    public void executeQuery(){
      setQueryMode(callService ? ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES : ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS);
      super.executeQuery();
    }By doing this, i could able to do table filtering but when i try to use table sorting or programmatic sorting, sorting is not at all getting applied.
    I changed the code like below one (i.e. changed to ViewObject.QUERY_MODE_SCAN_VIEW_ROWS instead of ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS)
    @Override
    public void executeQuery(){
      setQueryMode(callService ? ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES : ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
      super.executeQuery();
    }Now sorting is working fine but filtering is not working in an expected way because Scan_View_rows will do further filtering of view rows.
    If i OR'ed the Query Mode as given below, i am getting duplicate rows. (vewObject.QUERY_MODE_SCAN_ENTITY_ROWS | ViewObject.QUERY_MODE_SCAN_VIEW_ROWS) Question:
    I don't know how to achieve both filtering and sorting as well as skipping of service call too.
    Can anyone help on this?? Thanks in advance.
    Raguraman
    Edited by: Raguraman on Apr 12, 2011 6:53 AM

  • Simple java date related question

    Hi Friends,
    I have written this custom date class that compares two dates. The user can enter any number of days,and it should calculate the next date,is that possible???
    public class Date implements Comparable {
         private int month, day, year;
         public Date(int m, int d, int y) {
              month = m;
              day = d;
              year = y;
         public int compareTo(Object o) {
              Date a = this;
              Date b = (Date) o;
              if (a.year < b.year) return -1;
              if (a.year > b.year) return 1;
              if (a.month < b.month) return -1;
              if (a.month > b.month) return 1;
              if (a.day < b.day) return -1;
              if (a.day > b.day) return 1;
              return 0;
         public String toString() {
              return month + "/" + day + "/" + year;
         public static void main(String[] args) {
              Date d1 = new Date(21, 03, 2007);
              int days = Integer.parseInt(args[0]);
              System.out.println("New date is:"); // Need to print new date
    Expected output:
    java Date 30
    New date is: 04/20/2007If this is not possible with this class,how can we do this, any ideas.
    Your help would be appreciated.
    Thanks

    Hi,
    Try this code out:
    import java.text.DateFormat;
    import java.util.*;
    import javax.swing.JOptionPane;
    public class SimpleDate {
         private int month, day, year;
         public SimpleDate() {
              Date date = new Date();
             String myString = DateFormat.getDateInstance().format(date);
             StringTokenizer tokens = new StringTokenizer(myString, "/");
             day = Integer.parseInt(tokens.nextToken());
             month = Integer.parseInt(tokens.nextToken());
             year = Integer.parseInt(tokens.nextToken());
         public SimpleDate(String stdate) {
              try {
                   StringTokenizer tokens = new StringTokenizer(stdate, "/");
                   day = Integer.parseInt(tokens.nextToken());
                   month = Integer.parseInt(tokens.nextToken());
                   year = Integer.parseInt(tokens.nextToken());
              catch(Exception e) {
                   Date date = new Date();
                  String myString = DateFormat.getDateInstance().format(date);
                  StringTokenizer tokens = new StringTokenizer(myString, "/");
                  day = Integer.parseInt(tokens.nextToken());
                  month = Integer.parseInt(tokens.nextToken());
                  year = Integer.parseInt(tokens.nextToken());
                   JOptionPane.showMessageDialog(null, "Invalid String,\nDate set to current", "Invalid String", JOptionPane.ERROR_MESSAGE);
         public SimpleDate(int d, int m, int y) {
              month = m;
              day = d;
              year = y;
         public int compareTo(Object o) {
              SimpleDate a = this;
              SimpleDate b = (SimpleDate) o;
              if (a.year < b.year) return -1;
              if (a.year > b.year) return 1;
              if (a.month < b.month) return -1;
              if (a.month > b.month) return 1;
              if (a.day < b.day) return -1;
              if (a.day > b.day) return 1;
              return 0;
         private int getNumOfDaysInMonth() {
              boolean leap = false;
              int days = 30;
              if (year % 4 == 0) leap = true;
              if ((month == 1) | (month == 3) | (month == 5) | (month == 7) |
                        (month == 8) | (month == 10) | (month == 12)) {
                   days = 31;
              if ((month == 4) | (month == 6) | (month == 9) | (month == 11)) {
                   days = 30;
              if (month == 2) {
                   if (leap) {
                        days = 29;
                   else days = 28;
              return days;
         public void addDays(int nums) {
              while (nums > getNumOfDaysInMonth()) {
                   nums = nums - getNumOfDaysInMonth();
                   addMonths(1);
              day = day + nums;
              while (day > getNumOfDaysInMonth()) {
                   day = day - getNumOfDaysInMonth();
                   addMonths(1);
         public void addMonths(int nums) {
              while (nums > 12) {
                   nums = nums - 12;
                   addYears(1);
              month = month + nums;
              while (month > 12) {
                   month = month - 12;
                   addYears(1);
         public void addYears(int nums) {
              year = year + 1;
         public int getDay() {
              return day;
         public int getMonth() {
              return month;
         public int getYear() {
              return year;
         public String toString() {
              return day + "/" + month + "/" + year;
    }I have swapped the day and month around from mm/dd/yyyy to dd/mm/yyyy
    but otherwise its still the same basic code

  • Issue with "firstRecord" Business Component method of JAVA Data bean API.

    Hi,
    Following is my use-case scenario:
    I have to add or associate child MVG business component (CUT_Address)
    with the parent business component (Account) using JAVA Data bean API.
    My requirement is: first to check whether child business component(i.e. CUT_address) exists. If it exists then associate it with parent business component (Account)
    otherwise create new CUT_address and associate it with account.
    Code (using JAVA Data bean APIs) Goes as follows:
    SiebelBusObject sBusObj = connBean.getBusObject("Account");
    parentBusComp = sBusObj.getBusComp("Account");
    SiebelBusComp parentBusComp;
    SiebelBusComp childBusComp;
    // retrieve required account.. Please assume Account1 exists
    parentBusComp.activateField("Name");
    parentBusComp.clearToQuery();
    parentBusComp.setSearchSpec("Name", "Account1");
    sBusComp.executeQuery2(true, true);
    sBusComp.firstRecord();
    Counter = 0;
    while (counter < Number_Of_Child_Records_To_Insert)
    childBusComp = parentBusComp.getMVGBusComp("City");
    associatedChildBusComp = childBusComp.getAssocBusComp();
    childBusComp.activateField("City");
    childBusComp.clearToQuery();
    childBusComp.setSearchSpec("City", Vector_of_city[counter]);
    sBusComp.executeQuery2(true, true);
    if( sBusComp.firstRecord() )
    // Child already exist and do processing accordingly
    else
    // Child does not exist and do processing accordingly
    childBusComp.release();
    childBusComp = null;
    associatedChildBusComp.release();
    associatedChildBusComp=null;
    Now the issue with this code is: For the first iteration, SbusComp.firstRecord returns 0 if records does not exist. However from the second iteration, SbusComp.firstRecord returns 1 even if there is no record matching the search specification.
    Any input towards the issue is highly appreciable.
    Thanks,
    Rohit.

    Setting the view mode to "AllView" helped.
    Thanks for the lead!
    In the end, I also had to invoke the business component method SetAdminMode with "true" as the argument so that I could also modify the records from my script.

  • External SOAP client Accessing Webservice using built in Java Data type

    We have built a webservice and deployed it on WLS. We accessed this from a swing
    client it works fine.The webservice methods uses non-built in JAVA data types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass to the
    webservice. We dont want to go by this way.Is there anyway were in we can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net client )
    will be able to exceute my webservice (i.e., passing the required Object which
    the method is expecting)?

    Hi Anish,
    Well first off, your web service doesn't send or receive "objects". It only sends
    and recieves XML, which is in turn converted to/from Java objects at invocation
    time. Second, a .NET (or Perl, or Python, or C++) client will be able to call
    your web service, because the wsdl.exe tool (for .NET) will generate "programming
    language specific" objects from the <types><schema> elements, in the WSDL of your
    web service :-) The wsdl.exe tool will create C# objects from the WSDL, that will
    convert XML to/from C# when your web service is called. That's the beauty of XML
    schema - it's a "universal typing system", so it's not tied to a particular programming
    language. The only issue is whether or not the web services platform vendor's
    XML Schema/WSDL processor, can successfully process the WSDL. Some vendors have
    more complete implementations of the WSDL and XML Schema specs than others, so
    expect varying success here. The one in WLS 7.0 is pretty good, so you shouldn't
    have too many problems consuming WSDL generated by .NET tools (or any other tool
    for that matter).
    Regards,
    Mike Wooten
    "Anish" <[email protected]> wrote:
    >
    We have built a webservice and deployed it on WLS. We accessed this from
    a swing
    client it works fine.The webservice methods uses non-built in JAVA data
    types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value
    objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass
    to the
    webservice. We dont want to go by this way.Is there anyway were in we
    can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net
    client )
    will be able to exceute my webservice (i.e., passing the required Object
    which
    the method is expecting)?

  • From Time column in Excel to Java Date ?

    Hi there!
    After I have read range data from Excel to a Java Object[][]
    array/table, one of my excel time columns becomes "floats"
    numbers when I try to access them in Java, like this:
    from 15:00:00 in Excel to 0.625 in my Java program
    How can I avoid this OR transform/parse this 0.625 number
    back again to time/Date 15:00:00 inside Java ? hmmm
    Is there any setup of jCom that can controll this somehow ?
    I have been able to transform:
    from 11.15.01 in Excel, becomes "Thu Nov 15 00:00:00 CET 2001"
    with the jCom bridge ...
    When I have this "string" on this format, it's easy
    to get a Java Date of this with SimpleDateFormat.
    ... but not with this time of mine :-)
    Any clues where to look or a solution for this ?
    -- Thank you !
    -- Erlend

    Excel stores times as decimal fractions (representing portions of a day)
    There is no Time data type in VB so is probably represented by a Single
    object.
    This object is then converting to a java.lang.float on the Java side.
    0.625 can be parsed by multiplying by (24*60*60) to get the number
    of seconds after midnight.
    A list of supported COM data types and their java equivalents
    can be found in chapter 7 of the jCOMReference pdf file.
    damon
    "Erlend Bjorge" <[email protected]> wrote in message
    news:3be2983e$[email protected]..
    >
    Hi there!
    After I have read range data from Excel to a Java Object[][]
    array/table, one of my excel time columns becomes "floats"
    numbers when I try to access them in Java, like this:
    from 15:00:00 in Excel to 0.625 in my Java program
    How can I avoid this OR transform/parse this 0.625 number
    back again to time/Date 15:00:00 inside Java ? hmmm
    Is there any setup of jCom that can controll this somehow ?
    I have been able to transform:
    from 11.15.01 in Excel, becomes "Thu Nov 15 00:00:00 CET 2001"
    with the jCom bridge ...
    When I have this "string" on this format, it's easy
    to get a Java Date of this with SimpleDateFormat.
    ... but not with this time of mine :-)
    Any clues where to look or a solution for this ?
    -- Thank you !
    -- Erlend

  • Java dates from 0-11 or 1-12

    Hello
    In java Date, the months ranges from 0-11 . first january is thus 1/0/2003 (in dd/mm/yyyy form). But in almost all databases , month values are counted as 1-12 . That is first january becomes 1/1/2003 . Obviously we have to show the users month values from 1-12 and not from 0-11. This obviuosly places some overhead when doing calculations and display. Sometimes there are situations where we have to get the date from database using getString() function, but that will vary with the result of Resultset.getDate() . Any way to overcome such limitations? and why java has such dates?

    I kind of agree. When I first started, I felt that I shouldn't ever rely upon an assumption about the value of a constant field (i.e. Calendar.JANUARY, etc).
    But since I did need to have a user-intuitive interface (both in guis and because we deal regularly with processing today's or yesterday's version of a file named like yyyyMMdd.input), I always provided a class that was a day-only object who did its behind-the-scenes work with Calendar by using switch statements to choose the correct Calendar month constants (rather than by adding or subtracting one).
    But (a) that got old quick because of either the same cumbersome code repeated everywhere or having to have many otherwise simple standalone programs depend on a central utility class to do this, and (b) the Calendar class documentation states that the value of the month is zero-based, so the horror of assuming constant values is not so bad.
    So now I have slightly less cumbersome code (adding or subtracting one) repeated everywhere...

  • How to execute Custom java data source LOV view object from a common mthd?

    Hi,
    My application contains Custom java data source implemented LOVs. I want to have a util method which gets the view accessor name, find the view accessor and execute it. But i couldn't find any API to get the view accessors by passing the name.
    Can anyone help me iin how best view accessors can be accessed in common but no by creating ViewRowImpl class (By every developer) and by accessing the RowSet getters?
    Thanks in advance.

    I am sorrry, let me tell my requirement clearly.
    My application is not data base driven. Data transaction happens using tuxedo server.
    We have entity driven VOs as well as programmatic VOs. Both are custom java data source implemented. Entity driven VOs will participate in transactions whereas programmatic VOs are used as List view object to show List of values.
    Custom java datasource implementation in BaseService Viewobject Impl class looks like
            private boolean callService = false;
        private List serviceCallInputParams = null;
        public BaseServiceViewObjectImpl()
            super();
         * Overridden for custom java data source support.
        protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams)
            List dataFromService = null;
            if(callService)
                callService = retrieveDataFromService(serviceCallInputParams);
            setUserDataForCollection(qc, dataFromService != null? dataFromService.iterator(): null);   
            super.executeQueryForCollection(qc, params, noUserParams);
         * Overridden for custom java data source support.
        protected boolean hasNextForCollection(Object qc)
            Iterator<BaseDatum> datumItr = (Iterator<BaseDatum>) getUserDataForCollection(qc);
            if (datumItr != null && datumItr.hasNext())
                return true;
            callService = false;
            serviceCallInputParams = null;
            setFetchCompleteForCollection(qc, true);
            return false;
        }Individual screen developer, who want to load data to VO, will do something like the below code in their VO impl class
        public void fetch()
            BaseServiceViewObjectImpl vo = this;
            vo.setCallService(true);
            vo.setServiceCallInputParams(new ArrayList());
            vo.executeQuery();
        }As these custom java data source implemented LOV VOs comes across the screens, i want to have a util method at Base VOImpl class, that gets the view accessor name, finds the LOV VO instance, retrieves data for that. I want to do something like
         * Wrapper method available at Base Service ViewObject impl class
        public void fetchLOVData(String viewAccessorName, List serviewInputParams)
            // find the LOV View object instance
            BaseServiceViewObjectImpl lovViewObject  = (BaseServiceViewObjectImpl) findViewAccessor(viewAccessorName);
            // Get data for LOV view object from service
            lovViewObject.setCallService(true);
            lovViewObject.setServiceCallInputParams(serviewInputParams);
            lovViewObject.executeQuery();
    Question:
    1. Is it achievable?
    1. Is there any API available at View Object Impl class level, that gets the view accessor name and returns the exact LOV view object instance? If not, how can i achieve it?

  • Customized java date function in heart of JDK

    hi
    how can i force JDK to return Persian or Arabic date instead of christian era?
    i have an application in java platform. i couldn't change code of program, because source is closed and is not reachable. i want to know how can i use a wrapper for date function in java? if it is possible how can i replace java date functionality with my desired date function?
    thanks for any help

    Thanks for your help.
    however i looking for one thing, similar a function wrapper that can substitute original method.
    I don't know where the application use date function and how calls it. so i think that it is possible to change behavior of java itself.

  • Problem with updating oracle DB with java date thru resultset.updateDate()

    URGENT Please
    I am facing problem in updating oracle database with java date through resultset.updateDate() method. Can anybody help me please
    following code is saving wrong date value (dec 4, 2006 instead of java date jul 4, 2007) in database:
    ResultSet rs = stmt.executeQuery("SELECT myDate FROM myTable");
    rs.first();
    SimpleDateFormat sqlFormat = new SimpleDateFormat("yyyy-mm-dd");
    java.util.Date myDate = new Date();
    rs.updateDate("myDate", java.sql.Date.valueOf(sqlFormat.format(myDate)));
    rs.updateRow();

    I believe you should use yyyy-MM-dd instead of yyyy-mm-dd. I think MM stands for month while mm stands for minute as per
    http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    (If this works, after spending so much of your time trying to solve it, don't hit yourself in the head too hard. I find running out of the room laughing hysterically feels better).
    Here is a more standard(?) way of updating:
    String sqlStatement=
    "update myTable set myDate=? where personID=?"
    PreparedStatement p1= connection.prepareStatement(sqlStatement);
    p1.setDate(1,new java.sqlDate());
    p1.setInt(2, personID);
    p1.executeUpdate();

  • Java data types are tightly coupled or loosely coupled ?

    java data types are tightly coupled or loosely coupled ?

    Is this another interview question? If so, the answer you should have given is, "You, sir, have been smoking too much crack."

  • Connect to java data srvice

    hi,
    how to connect to java data/services ?
    I  had this error :
    Invalid root. The WEB-INF/flex folder must contain either flex-config.xml or services-config.xml.
    my project java is in : D:\SVN\VAZII\trunk\VaziiAdminService
    my project flex tha must use the service is in : D:\SVN\ICOSNET_WALLET\trunk\ConfortPayAdmin
    My server tomcat is in : C:\apache-tomcat-7.0.32
    what i must write in this input dialog box ?
    Root Folder, Root URl, and Context root
    thanks

    is there someone that knows flash builder here ?

  • Conversion of Packed Decimal Numbers to Java Data Types

    Hi all,
    I'm working with a mainframe file which contains datas in Packed Decimal Numbers.My requirement is to convert these datas to Java datatypes and also to convert the Java datatypes to Packed Decimal Numbers before storing them in the mainframe.
    Can anyone help me out with any code for converting Java data types to/from other data formats such as: EBCDIC, IBM370 COMP (binary numbers up to 9 digits), and COMP-16 (packed decimal numbers)?
    I would hugely appreciate any response to my query.
    Thanking you all,
    Kaushik.

    Rather than go that route, I'd instead look into providing a "service" on your mainframe to:
    1) provide a textual representation of the numbers (from native to text)
    2) read text, converting to native numeric storage
    And use that service to retrieve that information by your Java app (1)Similarly, instead of trying to write natively-formatted numbers from your Java app, I'd write it as text and make that same "service" read the text (2)
    This is the kind of thing XML is for.

Maybe you are looking for

  • ORA-29534 error for Class can not be resolved

    HI, I am trying to load and resolve a third party jar file which has some JMS classes. But while using the loadjava utility, "loadjava -u scott/tiger@dbname -r -v -genmissing weblogic.jar" i get "ORA-29534: referenced object <Class Name> could not be

  • ITouch does not appear in iTunes - file processes missing

    I recently updated to 9.2 about three weeks ago. When I plug in my iTouch, it is recognized by Windows and charges; however, it never appears in iTunes. I have a classic iPod. iTunes will recognize it and sync it. When I looked into the file processe

  • Installing windows 7 on MacBook Air 2013

    How to install windows 7 on Macbook Air 2013.

  • Overview Query creation option is missing

    Hi, All Overview query option is missing from SNC Web view , is there any backend config for this? Regards, Vikram

  • Unable to open Lightroom

    When I try to bring up Lightroom I get a message "Runtime Error" which says that "This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for moreinformation." This has never happene