hibernate報錯:MappingException: Could not determine type for...解決辦法


有時候實體里的一些屬性並不想映射到數據庫(比方說子級菜單List),

如果不做處理的話會報字段映射錯誤找不到這列Column Not Found

例如:org.hibernate.MappingException: Could not determine type for: java.util.List, at table: xxxx, for columns: [org.hibernate.mapping.Column(xxx)]

Hibernate實體類注解可以讓某些屬性不映射到數據庫

使用hibernate注解@Transien放在屬性上即可解決此問題。

import javax.persistence.Transient;

沒有get方法的屬性可以直接寫在屬性上面,有get方法的要在get方法上也寫上

 

 

import com.fasterxml.jackson.annotation.JsonIgnore;
@JsonIgnore

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM