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>

时间: 2024-12-11 12:51:16

Hibernate异常Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set的相关文章

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 table: ss_user, for columns: [org.hibernate.mapping.Column(roles)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:336) ~[hibernate-core-4

org.hibernate.MappingException: Could not determine type for: java.utils.Date

问题描述 org.hibernate.MappingException: Could not determine type for: java.utils.Date, at table: STUDENTS, for columns: [org.hibernate.mapping.Column(DATE)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:349) at org.hibernate.mapping.Simp

SpringMVC开发中遇到的异常1:No primary or default constructor found for interface java.util.List

Request processing failed; nested exception is java.lang.IllegalStateException: No primary or default constructor found for interface java.util.List 错误写法: 错误原因,没有默认的构造器,需要传输一个传输类 正确写法 DispatchDTO内容如下: 原文地址:https://www.cnblogs.com/wozixiaoyao/p/115792

hibernate 错误 could not determine type for

今天配置实体类注解时,出现以下错误: org.hibernate.MappingException: Could not determine type for: com.oneToOne.IdCard, at table: T_Students, for columns: 解决方案:注解要么写在字段上,要么写在getXX上,千万千万不能混合使用,否则会报这个错误!

SSH框架-Caused by: org.hibernate.MappingException: column attribute may not be used together with &lt;column&gt; subelement

昨晚修改了一些表关系,在相关的hbm.xml文件中做了改动,今天早上起来启动tomcat后,发现项目启动不了,控制台报错: 2015-6-14 9:09:42 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.Conte

hibernate 出现Caused by: java.sql.SQLException: Column &#39;id&#39; not found.异常

用hibernate进行映射查询时,出现Caused by: java.sql.SQLException: Column 'id' not found 异常,检查数据库表及映射都有id且已经正确映射,google后发现原因为: Your query doesn't return a field named id即查询sql中没有查询出主键id列,但返回结果集中用到,故出现异常特此记录. 详细解答见下: http://stackoverflow.com/questions/34164411/cau

Hibernate 异常总结

异常一 异常一 异常描述: Sax解析异常:cvc-复杂的类型,发现了以元素maping开头的无效内容,应该是以 '{"http://www.hibernate.org/xsd/orm/cfg":property, "http://www.hibernate.org/xsd/orm/cfg":mapping, "http://www.hibernate.org/xsd/orm/cfg":class-cache, "http://www.

Hibernate 异常 : Error parsing JNDI name [xxx]

初学 Hibernate ,用官方给的日志模板配置好了日志,跑起小例子, 控制台中的日志里写了一些异常: 21:16:36,036 DEBUG EntityLoader:146 -  Static select for entity cn.sjll.hibernate435.model.UserModel  [OPTIMISTIC_FORCE_INCREMENT]: select usermodel0_.ID as ID1_0_0_,  usermodel0_.NAME as NAME2_0_0

Caused by: org.hibernate.TransactionException: unable to commit against JDBC connection

1.错误描述 Caused by: org.hibernate.TransactionException: unable to commit against JDBC connection at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.java:116) at org.hibernate.engine.transaction.spi.AbstractTransa