IntelliJ Java IDE
The moose likes Object Relational Mapping and the fly likes Flush Hibernate issue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Flush Hibernate issue" Watch "Flush Hibernate issue" New topic
Author

Flush Hibernate issue

Thara Visu
Ranch Hand

Joined: May 17, 2005
Posts: 87
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.



Thara<br />SCJP 1.4 96%<br />SCBCD 1.3 96%
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Have you assigned this property a value or is it null?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Thara Visu
Ranch Hand

Joined: May 17, 2005
Posts: 87
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

Joined: Apr 14, 2004
Posts: 10336

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

Joined: May 17, 2005
Posts: 87
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

Joined: Apr 14, 2004
Posts: 10336


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

Joined: May 17, 2005
Posts: 87
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

Joined: Apr 14, 2004
Posts: 10336

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

Joined: May 17, 2005
Posts: 87
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?
 
 
subject: Flush Hibernate issue
 
Threads others viewed
NullPointerException when trying to run the Hibernate Example
Could not synchronize database
org.hibernate.exception.LockAcquisitionException without any explicit lock
Hibernate query
Mapping Exception
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com