org.hibernate.AnnotationException: mappedBy reference an unknown target entity property
2012-12-30 16:08
531 查看
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: entity.KpsysLog.user_table in entity.user_table.kpsyslog
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:685)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:645)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:65)
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1716)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1423)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
... 71 more
解决方法:
原代码:
@OneToMany(cascade={CascadeType.REMOVE},fetch=FetchType.EAGER,mappedBy="user_table")
@OrderBy("account ASC")
private Set<KpsysLog> kpsyslog;
@ManyToOne
@JoinColumn(name="account")
private user_table usert;
改为:
@OneToMany(cascade={CascadeType.REMOVE},fetch=FetchType.EAGER,mappedBy="usert")
@OrderBy("account ASC")
private Set<KpsysLog> kpsyslog;
@ManyToOne
@JoinColumn(name="account")
private user_table usert;
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:685)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:645)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:65)
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1716)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1423)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
... 71 more
解决方法:
原代码:
@OneToMany(cascade={CascadeType.REMOVE},fetch=FetchType.EAGER,mappedBy="user_table")
@OrderBy("account ASC")
private Set<KpsysLog> kpsyslog;
@ManyToOne
@JoinColumn(name="account")
private user_table usert;
改为:
@OneToMany(cascade={CascadeType.REMOVE},fetch=FetchType.EAGER,mappedBy="usert")
@OrderBy("account ASC")
private Set<KpsysLog> kpsyslog;
@ManyToOne
@JoinColumn(name="account")
private user_table usert;
相关文章推荐
- mappedBy reference an unknown target entity property
- mappedBy reference an unknown target entity property解决方法
- mappedBy reference an unknown target entity property解决方法
- mappedBy reference an unknown target entity property: com.sq.entity.Address.tt_user in com.sq.entit
- org.hibernate.AnnotationException: @org.hibernate.annotations.Table references an unknown table:
- nested exception is org.hibernate.AnnotationException: Unknown mappedBy in
- org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne property: entity.KpsysLog
- org.hibernate.AnnotationException: Referenced property not a (One|Many)ToOne: in mappedBy of
- Caused by: org.hibernate.TransientObjectException: object references an unsaved
- org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne property: entity.KpsysLog.
- Caused by: org.hibernate.AnnotationException: No identifier specified for entity
- org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance:
- org.hibernate.AnnotationException: property from @OrderBy clause not found
- org.hibernate.AnnotationException: Collection has neither generic type or OneToMany.targetEntity() defined: com.bjsxt.model.Student.courses
- org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance:
- org.hibernate.AnnotationException: Associations marked as mappedBy must not define database mappings
- org.hibernate.PropertyValueException: not-null property references a null or transient value: model.
- org.hibernate.propertyaccessexception could not get a field value by reflection getter of
- org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of org.catablog.entity.IdEntity.entityId
- Hibernate错误 Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for pnsame i