Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Flush Hibernate issue

 
Thara Visu
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,
I am facing the following exception. I am using Hibernate 3.2.3 and Oracle 9.2.1 driver. I also face a nullpointerexception at org.hibernate.type.PrimitiveType.toString(PrimitiveType.java:15) during session flush. What could be the possible reasons?
Any help would be highly appreciated.

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you assigned this property a value or is it null?
 
Thara Visu
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
The problem is there is so much of activity on the session, that it is too difficult to trace why this is occurring. The NPE is not helpful in understanding the issue. Can you quote some examples as to why this could occur? Or have you faced something similar to this?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somewhere you have used a primitive type for an object property. This property is probably maps a nullable field? Primitives can't be null. Check your mappings; make sure where you are using a primitive type you are not using it for a nullable field.
 
Thara Visu
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
Thanks for your input... But by primitype mapping for example do you mean a char or Character. If its a char am not using that. But if you are also taking about the wrappers, I will double check my code.
You have been wonderful replying so quickly buddy.. Thanks again. But I am gonna bug you until I understand/ am able resolve the issue.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But by primitype mapping for example do you mean a char or Character

char, int, byte, short, long, double etc.


You have been wonderful replying so quickly buddy.. Thanks again. But I am gonna bug you until I understand/ am able resolve the issue.

No bother. Keep pestering
 
Thara Visu
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does that mean, if I have a char in my class and use character in my hbm, It could be where the issue is?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a primitive that represents a field that can be null, you should be using the wrapper type instead (so yes, Character rather than char).
 
Thara Visu
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks buddy... I found the issue with your help. Like you said a Character was being set to null, but the question is how come it does not throw the error whenever the field is null?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic