Discussions

EJB programming & troubleshooting: SQL & Java Mapping using EJB's

  1. SQL & Java Mapping using EJB's (2 messages)

    I have created an EJB corresponding to one of the audit tables and the problem I am having is that when using the getter methods of the bean to get the values of the tables columns I get null pointer exceptions because some of the columns have null values. Is there a way to handle this. Also the other problem I have is that we have a column in the table with Oracle data type Date, format: mm/dd/yy hh:mm:ss, which on coversion to the java.sql.Date type returns only the Date part of the database value. Is there a way to extract the complete data format value?.

    Your help would be sincerely appreciated.

    Thanks
    Gautam

    Threaded Messages (2)

  2. SQL & Java Mapping using EJB's[ Go to top ]

    Hi,

    USe java.sql.Timestamp.getTime() to get the date and time.
    Let me know if you need more detail.

    Ravi
  3. More details...[ Go to top ]

    Use this,

    java.sql.Timestamp timestamp = resultSet.getTimeStamp(Field);
    java.util.Date date = timestamp.getTime();

    //date will have the date and time....

    I hope this will help you. let me know if you need more details...