今天要给一个实体类添加一个List集合属性!
private List<Reverts> childList = new ArrayList<Reverts>();
写完后get/set方法一写,启动就报错:
org.hibernate.MappingException: Could not determine type for: java.util.List, at table: T_REVERTS, for columns: [org.hibernate.mapping.Column(childList)]
解决办法:在属性的get方法上加上一段注解标识它是临时属性,不是数据库字段就OK
import javax.persistence.Transient; @Transient public List<Reverts> getChildList() { return childList; } public void setChildList(List<Reverts> childList) { this.childList = childList; }
原文链接:ttps://blog.csdn.net/lvcong60601413/article/details/78109383
文章评论