1. 程式人生 > >Hibernate異常Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set

Hibernate異常Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set

一:異常截圖


二:我的實體

@Entity
@Table(name = "p_user")
public class User extends AbstractEntity {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private long id;
	//賬號
	@Column(name = "account", nullable = true)
	private String account;
	
	//組織
	private Set<Organization> organizations = new HashSet<Organization>(0);
	
	
	
	@ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(name = "rel_user_organization", schema = "", joinColumns = { @JoinColumn(name = "user_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "organization_id", nullable = false, updatable = false) })
	public Set<Organization> getOrganizations() {
		return organizations;
	}

	public void setOrganizations(Set<Organization> organizations) {
		this.organizations = organizations;
	}
	

	//角色
	@ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(name = "rel_user_role", schema = "", joinColumns = { @JoinColumn(name = "user_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "role_id", nullable = false, updatable = false) })
	private Set<Role> roles = new HashSet<Role>(0);
	

	public Set<Role> getRoles() {
		return this.roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}
	

三:錯誤原因

<span style="color:#ff0000;">@ManyToMany等註解。要麼載入屬性上,要麼加在屬性的Get方法上,不能混合使用!</span>

相關推薦

Hibernate異常Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set

一:異常截圖 二:我的實體@Entity @Table(name = "p_user") public class User extends AbstractEntity { @Id @Gen

org.hibernate.MappingException: Could not determine type for: java.util.List, at table: user, for...

異常詳情: Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, at ta

註解配置實體類出現錯誤:Could not determine type for: java.util.Set, at table

org.hibernate.MappingException: Could not determine type for: java.util.Set, at table: bs_merchant, for columns: [org.hibernate.mapping.Co

實體類註解出錯: Could not determine type for: java.util.Set, at table: adm_role

配置了User與Role的多對多關係,啟動測試,提示如下錯誤:Could not determine type for: java.util.Set, at table: adm_role, for columns: [org.hibernate.mapping.Column

org.hibernate.MappingException: Could not determine type for: java.lang.string

唉,糾結很久,看到一個帖子,很管用呀,問題解決了。貼上帖子原文: 我的對映檔案中是這樣寫的: <property                 name= "operatorName "                 type= "java.lang.Strin

SSH框架問題——hbm.xml配置出現的org.hibernate.MappingException: Could not determine type for:(貌似叫資料型別轉換錯誤)問題

不知道大家有沒有碰到過這樣一個報錯: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImp': Injection of reso

【報錯】Caused by: org.hibernate.MappingException: Repeated column in mapping for entity:

報錯資訊: Caused by: org.hibernate.MappingException:         Repeated column in mapping for entity:              com.zking.four.entity.OrderI

Hibernate 專案啟動載入很慢,不聯網時啟動不了,還報異常Caused by: org.dom4j.DocumentException: www.hibernate.org Nested exc

異常資訊如下: 看到我那個對映檔案沒有PProduct.hbm.xml,裡面的頭部結構是這樣的:    <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC

Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet 報錯原因

jpa執行分頁操作時,可能報錯Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet 原

SSH執行hql報錯:Caused by: org.hibernate.hql.ast.QuerySyntaxException: user is not mapped [from user where username = ?]

執行 occurred ble xml文件 ron red 報錯 temp caused 報錯信息: ERROR Dispatcher:38 - Exception occurred during processing request: user is not mapped

菜鳥調錯——Spring Boo+JPA方式報錯:MappingException: Could not get constructor for org.hibernate.persister

文章目錄 錯誤資訊 軟體版本 錯誤背景 前提 推理 可能遇到的一些問題 結束 錯誤資訊 018-10-04 15:58:02.540 ERROR 4572 --- [ main] o.s

分享知識-快樂自己:Caused by: org.hibernate.tool.schema.extract.spi.SchemaExtractionException: More than one table found in namespace (, ) : Dept (XXX)

在名稱空間(,)中找到多個表 - SchemaExtractionException? 問題: 嘗試在Java應用程式中使用Hibernate將一些值儲存到表中時,我一直面臨著這個奇怪的異常。 但是,只有一個特定的表/實體才會出現此異常,因為其餘的表我可以通過Hibernate執行crud操作。

菜鳥調錯(十二)——Spring Boo+JPA方式報錯:MappingException: Could not get constructor for org.hibernate.persister

文章目錄錯誤資訊軟體版本錯誤背景前提推理結束 錯誤資訊 018-10-04 15:58:02.540 ERROR 4572 --- [ main] o.s.boot.SpringApplication Application run failed org.s

Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Unable to execute schema manag

這裡通過  spring jpa 設計資料的時候,處理問題,問題如下 Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Unable to execute schema mana

Spring MVC 單元測試異常 Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file

read cti exe document ive pri simple fff ces Sping 3.2.8.RELEASE + sping mvc + JDK 1.8運行異常。 java.lang.IllegalStateException: Failed to

Sping 3.2.3 異常 Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed

Spring MVC 單元測試異常 Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file Sping 3.2.8.RELEASE + sping mvc

Caused by: org.apache.solr.common.SolrException: Index locked for write for core XXX 異常解決

Caused by: org.apache.solr.common.SolrException: Index locked for write for core XXX at org.apache.solr.core.SolrCore.<init>(SolrCore.java

Could not find result map java.util.Map

org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.util.Map  1.檢視是否將resultType寫成resultMap有則修改  2.全域性搜尋

Could not determine artifacts for com.android.support:support-fragment:28.0.0

使用AS建立Activity的時候,出現 Could not resolve all dependencies for configuration ‘:publisherTmOffDebugCompileClasspath’. Could not determine artifacts

Mybatis報錯Could not find parameter map java.util.Map

原來在MyBatis裡面這樣寫的: <select id="aaa" resultMap="java.util.Map" > 正確寫法是這樣: <select id="aaa" resultType="java.util.Map" > 錯誤寫法二: