Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java @Spring和Hibernate3的可嵌入问题_Java_Spring_Hibernate_Jpa_Annotations - Fatal编程技术网

Java @Spring和Hibernate3的可嵌入问题

Java @Spring和Hibernate3的可嵌入问题,java,spring,hibernate,jpa,annotations,Java,Spring,Hibernate,Jpa,Annotations,我在使用@Embeddeble class作为联接类代表映射实体以实现多对多联接表时遇到问题。基本上,以下是我试图实现的目标: 我遵循了Java Hibernate持久性手册中给出的教程,但仍然收到来自以下方法的错误: org.hibernate.AnnotationException:使用@OneToMany或@ManyToMany针对未映射的类:nz.co.doltech.ims.project.server.entities.CategoryEntity.IncidentCategory

我在使用@Embeddeble class作为联接类代表映射实体以实现多对多联接表时遇到问题。基本上,以下是我试图实现的目标:

我遵循了Java Hibernate持久性手册中给出的教程,但仍然收到来自以下方法的错误:

org.hibernate.AnnotationException:使用@OneToMany或@ManyToMany针对未映射的类:nz.co.doltech.ims.project.server.entities.CategoryEntity.IncidentCategoryJoin[nz.co.doltech.ims.project.server.entitities.IncidentCategoryJoin] 位于org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1185) 位于org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:710) 位于org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:645) 位于org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:65) 位于org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1716) 位于org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1423) 位于org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375) 位于org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:720) 位于org.springframework.orm.hibernate3.AbstractSessionFactoryBean.AfterPropertieSet(AbstractSessionFactoryBean.java:188) 位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541) 位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)

我正在使用spring设置hibernate:

org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean

Spring-Appcontext.xml:


类路径:nz/co/doltech/ims/path.properties
类路径:nz/co/doltech/ims/project/project.properties
类路径:nz/co/doltech/ims/framework/framework.properties
${path.project}.server.entities
${project.hibernate.dial}
${project.hibernate.show_sql}
${project.hibernate.hbm2ddl}
没有一个
下面是我的注释实体类

CategoryEntity.java:

@javax.persistence.Entity
@表(name=“categories”)
公共类CategoryEntity实现实体{
@身份证
@GeneratedValue(策略=GenerationType.IDENTITY)
@列(unique=true,nullable=false)
private int id=Entity.UNSAVED_id;
@基本(可选=假)
@列(nullable=false,长度=128)
私有字符串名称;
@基本(可选=假)
@列(nullable=false,长度=512)
私有字符串描述;
@OneToMany(mappedBy=“类别”)
私有集合意外类别联接;
@可接合(
name=“category\u categorytype”,
joinColumns=@JoinColumn(name=“category\u id”)
)
私有集类别类型联接;
//id列
@凌驾
公共int getId(){
返回此.id;
}
公共无效集合id(内部id){
this.id=id;
}
//名称列
公共字符串getName(){
返回此.name;
}
公共void集合名(字符串名){
this.name=名称;
}
//说明栏
公共字符串getDescription(){
返回此.description;
}
公共void集合描述(字符串描述){
this.description=描述;
}
//事件联接列
公共集getIncidentCategoryJoins(){
返回意外类别联接;
}
公共无效setIncidentCategoryJoins(集合
附带类别(连接){
this.incidentCategoryJoins=incidentCategoryJoins;
}
//类别类型联接列
公共集getCategoryTypeJoins(){
返回categoryTypeJoins;
}
公共void setCategoryTypeJoins(集合categoryTypeJoins){
this.categoryTypeJoins=categoryTypeJoins;
}
}
IncidentsEntity.java:

@javax.persistence.Entity(name=“incents”)
公共类IncidentEntity实现实体{
@身份证
@GeneratedValue(策略=GenerationType.IDENTITY)
@列(unique=true,nullable=false)
private int id=Entity.UNSAVED_id;
@基本的
私人字符串所有者;
@列(长度=256)
私有字符串描述;
@列(name=“创建日期”)
私有字符串创建日期;
@列(长度=128)
私有字符串标题;
@柱(长度=20)
私有字符串日期;
@列(name=“location\u details”,长度=512)
私有字符串位置详细信息;
@列(name=“涉及当局”,长度=512)
涉及私人字符串;
私人身份;
私人和国家;
@列(名称=“子州”)
私有int子状态;
@列(name=“报告人”)
私人int报告人;
@可接合(
name=“事件类别”,
joinColumns=@JoinColumn(name=“事件id”)
)
@嵌入
私有集合意外类别联接;
//id列
@凌驾
公共int getId(){
返回此.id;
}
公共无效集合id(内部id){
this.id=id;
}
//说明栏
公共字符串getDescription(){
返回此.description;
}
公共void集合描述(字符串描述){
this.description=描述;
}
//所有者栏
公共字符串getOwner(){
归还此文件。所有者;
}
公共void集合所有者(字符串所有者){
this.owner=所有者;
}
//创建日期列
公共字符串getCreationDate(){
把这个还给我