---
title: " Null value was assigned to a property of primitive type setter of"
author: "hehaisu"
date: "2014-09-15T13:34:44Z"
tags: ["Hibernate", "Struts2"]
categories: ["编程语言"]
slug: "null-value-was-assigned-to-a-property-of-primitive-type-setter-of"
draft: false
lastmod: "2014-09-17T17:37:14Z"
id: 2116574
url: "https://heiwado.iteye.com/blog/2116574"
---

问题描述：在action请求数据的过程中报出"Null value was assigned to a property of primitive type setter of"错误，搜索之后发现是因为数据库里相应的字段为NULL。
解决办法：
    第一种：数据库字段不设置为空；
    第二种：修改java类中基础类型为其包装类，如int(Integer)



我就是用的第二种