使用OpenJPA 的时候merge一个model, 他的某一个属性为空,但是本来那个属性不为空,发现不能使其变为空。
if (gradebookitem.getStandards() == null){
List<Standards> standards = new ArrayList<Standards>();
gradebookitem.setStandards(standards);
}
可以进行如上操作,使其变为空。
本文探讨了在使用OpenJPA时遇到的一个挑战:如何在merge操作后,将模型中原本非空的属性变为null。通过提供一个具体的代码示例,详细解释了如何实现这一操作。
使用OpenJPA 的时候merge一个model, 他的某一个属性为空,但是本来那个属性不为空,发现不能使其变为空。
if (gradebookitem.getStandards() == null){
List<Standards> standards = new ArrayList<Standards>();
gradebookitem.setStandards(standards);
}
可以进行如上操作,使其变为空。
1767
476
468

被折叠的 条评论
为什么被折叠?