-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to handle null for the Primitive data types.
PostPosted: Mon Sep 27, 2010 10:24 am 
Newbie

Joined: Tue Sep 14, 2010 10:59 am
Posts: 2
I have legacy pojo object which has some primitive attributes and its been mapped to table...

When we load the object with null value being returned for the primitive type by the database....hibernate throws the following exception.

com.fmrco.gett.refdata.util.RefDataException: Error in retrieving the Command data = org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.fmrco.gett.refdata.entity.command.Parameter.parameterPosition
at com.fmrco.gett.refdata.dao.impl.HibernateCommandDAO.findAllCommands(HibernateCommandDAO.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)


Top
 Profile  
 
 Post subject: Re: How to handle null for the Primitive data types.
PostPosted: Mon Sep 27, 2010 10:29 am 
Newbie

Joined: Mon Sep 27, 2010 9:16 am
Posts: 2
sampathkumarpb wrote:
I have legacy pojo object which has some primitive attributes and its been mapped to table...

When we load the object with null value being returned for the primitive type by the database....hibernate throws the following exception.

com.fmrco.gett.refdata.util.RefDataException: Error in retrieving the Command data = org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.fmrco.gett.refdata.entity.command.Parameter.parameterPosition
at com.fmrco.gett.refdata.dao.impl.HibernateCommandDAO.findAllCommands(HibernateCommandDAO.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)


Use object types to create fields of your persistent entities (except marked by @Transient). It's more safety and efficient after all.


Top
 Profile  
 
 Post subject: Re: How to handle null for the Primitive data types.
PostPosted: Thu Sep 30, 2010 8:39 am 
Beginner
Beginner

Joined: Fri Nov 14, 2008 7:34 pm
Posts: 24
alter table.column not null default 0


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.