Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Flush Hibernate issue

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Did you miss me? Did you miss this tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic