• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQL & Java Data Mapping using EJB

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created an EJB corresponding to one of the auidt 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 greatly appreciated.

Thanks
Gautam
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The most obvious way to avoid NPEs in any Java program is to check if a reference is null before calling methods on it.

Layne
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gautam,
java.sql.Date stores precision to the nearest date. java.sql.TimeStamp stores the time and date values. So if you map to TimeStamp instead, you will get the full value as stored in Oracle.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic