---
title: "jpa merge 一个属性为null的model"
author: "whoosh"
date: "2012-08-07T15:11:51Z"
tags: []
categories: ["编程语言"]
slug: "jpa-merge-null-model"
draft: false
lastmod: "2012-08-07T15:11:51Z"
id: 1623394
url: "https://whoosh.iteye.com/blog/1623394"
---

使用OpenJPA 的时候merge一个model， 他的某一个属性为空，但是本来那个属性不为空，发现不能使其变为空。

 

```
if (gradebookitem.getStandards() == null){
	    			List<Standards> standards = new ArrayList<Standards>();
	    			gradebookitem.setStandards(standards);
	    		}
```

 

可以进行如上操作，使其变为空。