org.hibernate.MappingException:无法确定类型:java.util.List,在表:Schedule_assignedRoles,对于列:assignedRoles

时间:2016-05-19 12:28:49

标签: java hibernate jpa mappingexception

我需要帮助,我尝试使用地图,但是我收到了这个错误:

  

引起:org.hibernate.MappingException:无法确定:java.util.List的类型,在表:Schedule_assignedRoles,列:[org.hibernate.mapping.Column(assignedRoles)]       在org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:390)       在org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:363)       在org.hibernate.mapping.Collection.validate(Collection.java:310)       在org.hibernate.mapping.IndexedCollection.validate(IndexedCollection.java:74)       在org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:333)       在org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:443)       在org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802)

这里是我的代码:

#! /usr/bin/python
#
print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print '<title>Rapsberry Pi</title><p>'
for count in range(1,100):
   print 'Hello&nbsp;World...'
print "</p></body></html>"

感谢&#39; S! :d

1 个答案:

答案 0 :(得分:0)

我认为使用@ManyToMany@OneToMany足以完成您的任务

@Entity
public class Schedule extends PersistentObject implements Comparable<Schedule> {

   @Column
   private String title;

   @ManyToOne
   private Agent target;

   @OneToMany 
   private List<Unit> units = new List<>();

}

@Entity
public class Unit {

  @ManyToMany 
  private List<Role> assignedRoles = new List<>();

}