2017-05-15 8 views
0

私のモデルクラスは、MySQLデータベースからHibernateによって生成されています。Spring MVC + Hibernate:モデルクラスを再生成した後のBeanCreationExceptionエラー

私は、アプリケーションとデータベースのやりとりのためのDAOオブジェクトとサービスを作成しました。すべてがうまくいきました。

今日、私のデータベースの「サイト」テーブルが更新されました。私がHibernateでモデルのクラスを再生成すると、問題が発生しました。

私はorg.springframework.beans.factory.BeanCreationExceptionを取得しました。Tomcat Serverを起動しようとすると、名前が 'appConfig'のBeanを作成できませんでした。

私は何を欠席しましたか?ここに私のAppConfigクラスと、生成されたSite.javaクラスがあります。以前のものに置き換えると、すべて正常に動作します。

EDIT

mai 15, 2017 3:50:44 PM org.springframework.web.context.support.AnnotationConfigWebApplicationContext refresh 
AVERTISSEMENT: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.converter.RoleToUserProfileConverter com.sggsmi.bending.configuration.AppConfig.roleToUserProfileConverter; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleToUserProfileConverter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.service.UserProfileService com.sggsmi.bending.converter.RoleToUserProfileConverter.userProfileService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.dao.UserProfileDao com.sggsmi.bending.service.UserProfileServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sggsmi.bending.dao.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/sggsmi/bending/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.sggsmi.bending.model.Machine.setups in com.sggsmi.bending.model.Setup.machines 
mai 15, 2017 3:50:44 PM org.springframework.web.context.ContextLoader initWebApplicationContext 
GRAVE: Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.converter.RoleToUserProfileConverter com.sggsmi.bending.configuration.AppConfig.roleToUserProfileConverter; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleToUserProfileConverter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.service.UserProfileService com.sggsmi.bending.converter.RoleToUserProfileConverter.userProfileService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.dao.UserProfileDao com.sggsmi.bending.service.UserProfileServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sggsmi.bending.dao.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/sggsmi/bending/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.sggsmi.bending.model.Machine.setups in com.sggsmi.bending.model.Setup.machines 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) 
    at org.springframework.context.support.AbstractApplicationContext.initMessageSource(AbstractApplicationContext.java:697) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:526) 
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4730) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5194) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1406) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.converter.RoleToUserProfileConverter com.sggsmi.bending.configuration.AppConfig.roleToUserProfileConverter; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleToUserProfileConverter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.service.UserProfileService com.sggsmi.bending.converter.RoleToUserProfileConverter.userProfileService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.dao.UserProfileDao com.sggsmi.bending.service.UserProfileServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sggsmi.bending.dao.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/sggsmi/bending/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.sggsmi.bending.model.Machine.setups in com.sggsmi.bending.model.Setup.machines 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) 
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) 
    ... 30 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleToUserProfileConverter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.service.UserProfileService com.sggsmi.bending.converter.RoleToUserProfileConverter.userProfileService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.dao.UserProfileDao com.sggsmi.bending.service.UserProfileServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sggsmi.bending.dao.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/sggsmi/bending/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.sggsmi.bending.model.Machine.setups in com.sggsmi.bending.model.Setup.machines 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) 
    ... 32 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.service.UserProfileService com.sggsmi.bending.converter.RoleToUserProfileConverter.userProfileService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.dao.UserProfileDao com.sggsmi.bending.service.UserProfileServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sggsmi.bending.dao.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/sggsmi/bending/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.sggsmi.bending.model.Machine.setups in com.sggsmi.bending.model.Setup.machines 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) 
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) 
    ... 43 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.dao.UserProfileDao com.sggsmi.bending.service.UserProfileServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sggsmi.bending.dao.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/sggsmi/bending/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.sggsmi.bending.model.Machine.setups in com.sggsmi.bending.model.Setup.machines 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) 
    ... 45 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sggsmi.bending.dao.UserProfileDao com.sggsmi.bending.service.UserProfileServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sggsmi.bending.dao.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/sggsmi/bending/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.sggsmi.bending.model.Machine.setups in com.sggsmi.bending.model.Setup.machines 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) 
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) 
    ... 56 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sggsmi.bending.dao.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/sggsmi/bending/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.sggsmi.bending.model.Machine.setups in com.sggsmi.bending.model.Setup.machines 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) 
    ... 58 more 

EDIT 2

Machine.java

package com.sggsmi.bending.model; 
// Generated 15 mai 2017 16:18:03 by Hibernate Tools 5.1.0.Beta1 

import javax.persistence.Column; 
import javax.persistence.Entity; 
import javax.persistence.FetchType; 
import javax.persistence.Id; 
import javax.persistence.JoinColumn; 
import javax.persistence.ManyToOne; 
import javax.persistence.Table; 

/** 
* Machine generated by hbm2java 
*/ 
@Entity 
@Table(name = "machine", catalog = "bec") 
public class Machine implements java.io.Serializable { 

    private int machineId; 
    private Site site; 
    private String machineName; 

    public Machine() { 
    } 

    public Machine(int machineId, Site site, String machineName) { 
     this.machineId = machineId; 
     this.site = site; 
     this.machineName = machineName; 
    } 

    @Id 

    @Column(name = "machineId", unique = true, nullable = false) 
    public int getMachineId() { 
     return this.machineId; 
    } 

    public void setMachineId(int machineId) { 
     this.machineId = machineId; 
    } 

    @ManyToOne(fetch = FetchType.LAZY) 
    @JoinColumn(name = "siteId", nullable = false) 
    public Site getSite() { 
     return this.site; 
    } 

    public void setSite(Site site) { 
     this.site = site; 
    } 

    @Column(name = "machineName", nullable = false, length = 50) 
    public String getMachineName() { 
     return this.machineName; 
    } 

    public void setMachineName(String machineName) { 
     this.machineName = machineName; 
    } 

} 

Setup.java

package com.sggsmi.bending.model; 
// Generated 24 mars 2017 17:13:20 by Hibernate Tools 5.1.0.Beta1 

import java.util.HashSet; 
import java.util.Set; 
import javax.persistence.Column; 
import javax.persistence.Entity; 
import javax.persistence.FetchType; 
import javax.persistence.Id; 
import javax.persistence.JoinColumn; 
import javax.persistence.JoinTable; 
import javax.persistence.ManyToMany; 
import javax.persistence.Table; 

/** 
* Setup generated by hbm2java 
*/ 
@Entity 
@Table(name = "setup", catalog = "bec") 
public class Setup implements java.io.Serializable { 

    private int setupId; 
    private boolean pbi; 
    private boolean shape; 
    private float widthMin; 
    private float widthMax; 
    private float heightMin; 
    private float heightMax; 
    private int retrait; 
    private Set<Machine> machines = new HashSet<Machine>(0); 
    private Set<Articles> articleses = new HashSet<Articles>(0); 

    public Setup() { 
    } 

    public Setup(int setupId, boolean pbi, boolean shape, float widthMin, float widthMax, float heightMin, 
      float heightMax, int retrait) { 
     this.setupId = setupId; 
     this.pbi = pbi; 
     this.shape = shape; 
     this.widthMin = widthMin; 
     this.widthMax = widthMax; 
     this.heightMin = heightMin; 
     this.heightMax = heightMax; 
     this.retrait = retrait; 
    } 

    public Setup(int setupId, boolean pbi, boolean shape, float widthMin, float widthMax, float heightMin, 
      float heightMax, int retrait, Set<Machine> machines, Set<Articles> articleses) { 
     this.setupId = setupId; 
     this.pbi = pbi; 
     this.shape = shape; 
     this.widthMin = widthMin; 
     this.widthMax = widthMax; 
     this.heightMin = heightMin; 
     this.heightMax = heightMax; 
     this.retrait = retrait; 
     this.machines = machines; 
     this.articleses = articleses; 
    } 

    @Id 

    @Column(name = "setupId", unique = true, nullable = false) 
    public int getSetupId() { 
     return this.setupId; 
    } 

    public void setSetupId(int setupId) { 
     this.setupId = setupId; 
    } 

    @Column(name = "pbi", nullable = false) 
    public boolean isPbi() { 
     return this.pbi; 
    } 

    public void setPbi(boolean pbi) { 
     this.pbi = pbi; 
    } 

    @Column(name = "shape", nullable = false) 
    public boolean isShape() { 
     return this.shape; 
    } 

    public void setShape(boolean shape) { 
     this.shape = shape; 
    } 

    @Column(name = "widthMin", nullable = false, precision = 12, scale = 0) 
    public float getWidthMin() { 
     return this.widthMin; 
    } 

    public void setWidthMin(float widthMin) { 
     this.widthMin = widthMin; 
    } 

    @Column(name = "widthMax", nullable = false, precision = 12, scale = 0) 
    public float getWidthMax() { 
     return this.widthMax; 
    } 

    public void setWidthMax(float widthMax) { 
     this.widthMax = widthMax; 
    } 

    @Column(name = "heightMin", nullable = false, precision = 12, scale = 0) 
    public float getHeightMin() { 
     return this.heightMin; 
    } 

    public void setHeightMin(float heightMin) { 
     this.heightMin = heightMin; 
    } 

    @Column(name = "heightMax", nullable = false, precision = 12, scale = 0) 
    public float getHeightMax() { 
     return this.heightMax; 
    } 

    public void setHeightMax(float heightMax) { 
     this.heightMax = heightMax; 
    } 

    @Column(name = "retrait", nullable = false) 
    public int getRetrait() { 
     return this.retrait; 
    } 

    public void setRetrait(int retrait) { 
     this.retrait = retrait; 
    } 

    @ManyToMany(fetch = FetchType.LAZY, mappedBy = "setups") 
    public Set<Machine> getMachines() { 
     return this.machines; 
    } 

    public void setMachines(Set<Machine> machines) { 
     this.machines = machines; 
    } 

    @ManyToMany(fetch = FetchType.LAZY) 
    @JoinTable(name = "setuparticle", catalog = "bec", joinColumns = { 
      @JoinColumn(name = "setupId", nullable = false, updatable = false) }, inverseJoinColumns = { 
        @JoinColumn(name = "artId", nullable = false, updatable = false) }) 
    public Set<Articles> getArticleses() { 
     return this.articleses; 
    } 

    public void setArticleses(Set<Articles> articleses) { 
     this.articleses = articleses; 
    } 

} 
+0

と完全なスタックトレースをポイントする必要があるので、多対多としてリンクしてください – StanislavL

+0

私はそれのほとんどを追加しましたが、私は30000文字に制限されています。 –

+0

trace mappedBy参照から、未知のターゲットエンティティプロパティ:com.sggsm.bending.model.Machine.setups in com.sggsm.bending.model.Setup.machines。あなたのエンティティが不明で、マップされていないプロパティを参照していると何かが間違っています – StanislavL

答えて

1

trace mappedByリファレンスから、未知のターゲットエンティティプロパティ:com.sggsm.bending.model.Machine.setups in com.sggsm.bending.model.Setup.machines。それはあなたがセットアップエンティティ

@ManyToMany(fetch = FetchType.LAZY, mappedBy = "setups") 
public Set<Machine> getMachines() { 
    return this.machines; 
} 

に持っていますが、マシンにはセットアップが存在しない未知のを基準に、あなたのエンティティと間違って何か、マッピングされていないプロパティ

です。

彼らはあなたが関係テーブルMachine_Setup(それは実際にあなたのDBに呼ばれています方法がわからない)

1

SetupMachineの関係が原因で発生しているようです。

このエラーは、あるエンティティがマッピングコンフィグレーションに含まれ、他のエンティティが含まれていない場合、または注釈のmappedBy属性が、参照先のエンティティクラスの名前が不正なプロパティを示す場合に発生します。

+0

アドバイスをいただきありがとうございます。私はエラーを探しています、私は私のポストで2つのクラスを追加し、問題がどこにあるかを教えてください。 あなたの答えをありがとう! –

+0

あなたの 'Setup#getMachines'は' mappedBy = "setups"を持っています。これは 'Machines'の' setups'というプロパティ/マッピングを持っていなければならないことを意味します。 – Naros

+0

2つの回答を受け入れることはできませんが、両方ともお世話になりました! –

関連する問題