This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null Pointer exception despite using Float

 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi All ,
Im trying to insert null values into a database for a particular column , if there has been no entry into a field .
I'm using a bean to carry my data around .



fmotorrating is defined as

Any pointers as to why this could be happening?
 
Harsha Smith
Ranch Hand
Posts: 287
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.equals or == null?

Line 2
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you get exception at stmt.setNull(8, Types.FLOAT); ? because even I doubt that how the if statement is succeed?
 
lokesh pattajoshi
Ranch Hand
Posts: 130
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If is returning null than in that line only you will get Null Pointer Exception as you can't use dot operator on null.

Instead of you can use
Regards,
Lokesh
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All I tried that , earlier it wasnt working however now its working . Weird .

Thank you for your help . All!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic