私は、hibernateと以下のエンティティを使用するWebアプリケーションを持っています。 私は何が間違っていますか?私はこれを使用すると双方向の休止状態の関係
...
@Entity
public class Registration implements BaseEntity {
...
@OneToMany(cascade = {CascadeType.PERSIST}, mappedBy = "registration", fetch = FetchType.EAGER)
private List<OrderedProduct> orderedProducts = new ArrayList<OrderedProduct>();
...
public List<OrderedProduct> getOrderedProducts() {
return orderedProducts;
}
public void setOrderedProducts(List<OrderedProduct> orderedProducts) {
this.orderedProducts = orderedProducts;
}
...
...
@Entity
public class OrderedProduct implements BaseEntity {
...
@ManyToOne
@JoinColumn(name = "registration_id",nullable = true)
private Registration registration;
...
public Registration getRegistration() {
return registration;
}
public void setRegistration(Registration registration) {
this.registration = registration;
}
...
、私は次のTomcatのエラーを取得:リストで
Caused by: org.hibernate.AnnotationException: Illegal use of mappedBy on both sides of the relationship: at.irian.conference.domain.Registration.orderedProducts
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:193)
at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:1325)
at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1164)
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:602)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:543)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1163)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:329)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
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:425)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:221)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:251)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1257)
... 86 more
あなたの関係はどのように見えますか? 登録[1] - > [0..n] OrderProductsで、双方向にマップしたいですか? – lud0h
1件の登録には多くの注文商品=> 1:n – ddejmek