2017-06-08 4 views
0

実際にどこが間違っているのか分かりませんが、誰かがこのエラーを取り除くのに役立ちます。Err:mappedBy unknownターゲットエンティティのプロパティを参照しています。

@Entity 
@Table(name="nifty", catalog="portfolio") 
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id",scope=NiftyDTO.class) 
@JsonIgnoreProperties({"latestData","data"}) 

public class NiftyDTO implements Serializable { 

private static final long serialVersionUID = 1L; 



@Id 
@Column(name="niftyid") 
@GeneratedValue(strategy = GenerationType.IDENTITY) 
private Long id; 



@Column(name="time") 
private String time; 

@Column(name="trdVolumesumMil") 
private String trdVolumesumMil; 

@Column(name="declines") 
private int declines; 

@Column(name="trdValueSum") 
private String trdValueSum; 

@Column(name="trdValueSumMil") 
private String trdValueSumMil; 

@Column(name="unchanged") 
private int unchanged; 

@Column(name="trdVolumesum") 
private String trdVolumesum; 

@Column(name="advances") 
private int advances; 






public Long getId() { 
    return id; 
} 

public void setId(Long id) { 
    this.id = id; 
} 

public String getTime() { 
    return time; 
} 

public void setTime(String time) { 
    this.time = time; 
} 

public String getTrdVolumesumMil() { 
    return trdVolumesumMil; 
} 

public void setTrdVolumesumMil(String trdVolumesumMil) { 
    this.trdVolumesumMil = trdVolumesumMil; 
} 

public int getDeclines() { 
    return declines; 
} 

public void setDeclines(int declines) { 
    this.declines = declines; 
} 

public String getTrdValueSum() { 
    return trdValueSum; 
} 

public void setTrdValueSum(String trdValueSum) { 
    this.trdValueSum = trdValueSum; 
} 

public String getTrdValueSumMil() { 
    return trdValueSumMil; 
} 

public void setTrdValueSumMil(String trdValueSumMil) { 
    this.trdValueSumMil = trdValueSumMil; 
} 

public int getUnchanged() { 
    return unchanged; 
} 

public void setUnchanged(int unchanged) { 
    this.unchanged = unchanged; 
} 

public String getTrdVolumesum() { 
    return trdVolumesum; 
} 

public void setTrdVolumesum(String trdVolumesum) { 
    this.trdVolumesum = trdVolumesum; 
} 

public int getAdvances() { 
    return advances; 
} 

public void setAdvances(int advances) { 
    this.advances = advances; 
} 

public NiftyDTO() { 
    super(); 
} 

@OneToMany(mappedBy = "nifty", cascade = CascadeType.ALL, fetch = FetchType.LAZY) 
private Set<NiftyDataDTO> niftyDataDTO; 

public Set<NiftyDataDTO> getNiftyDataDTO() { 
    return niftyDataDTO; 
} 

public void setNiftyDataDTO(Set<NiftyDataDTO> niftyDataDTO) { 
    this.niftyDataDTO = niftyDataDTO; 
} 

public NiftyDTO(Long id, String trdVolumesumMil, String time, int declines, String trdValueSum, String trdValueSumMil, int unchanged, String trdVolumesum, int advances, Set<NiftyDataDTO> niftyDatumDTOS) { 
    this.id = id; 
    this.trdVolumesumMil = trdVolumesumMil; 
    this.time = time; 
    this.declines = declines; 
    this.trdValueSum = trdValueSum; 
    this.trdValueSumMil = trdValueSumMil; 
    this.unchanged = unchanged; 
    this.trdVolumesum = trdVolumesum; 
    this.advances = advances; 
    this.niftyDataDTO = niftyDataDTO; 
} 



} 

これは私の別のクラス

@Entity 
@Table(name="NiftyDataDTO", catalog="portfolio") 
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id", scope=NiftyDataDTO.class) 


@JsonIgnoreProperties({"ptsC","per","trdVol","trdVolM","ntP","mVal","wkhi","wklo","wkhicm_adj","wklocm_adj","xDt","cAct","previousClose","dayEndClose","yPC","mPC"}) 

public class NiftyDataDTO implements Serializable { 

private static final long serialVersionUID = 1L; 

@Id 
@Column(name = "dataId") 
@GeneratedValue(strategy = GenerationType.IDENTITY) 
private Long id; 

@Column(name="symbol", nullable = false) 
private String symbol; 

@Column(name="open") 
private float open; 

@Column(name="high") 
private float high; 

@Column(name="low") 
private float low; 

@Column(name = "itp") 
private float itp; 

@XmlTransient 
@ManyToOne(optional = true ,fetch = FetchType.LAZY) 
@JoinColumn(name = "niftyid", referencedColumnName = "niftyid") 
private NiftyDTO niftyDTO; 

@JsonIgnore 
public NiftyDTO getNiftyDTO() { return niftyDTO;} 

public NiftyDataDTO(Long id, String symbol, float open, float high, float low, float itp, NiftyDTO niftyDTO) { 
    super(); 
    this.id = id; 
    this.symbol = symbol; 
    this.open = open; 
    this.high = high; 
    this.low = low; 
    this.itp = itp; 
    this.niftyDTO = niftyDTO; 
} 


//Getter And Setter 


public Long getId() { 
    return id; 
} 

public void setId(Long id) { 
    this.id = id; 
} 

public String getSymbol() { 
    return symbol; 
} 

public void setSymbol(String symbol) { 
    this.symbol = symbol; 
} 

public float getOpen() { 
    return open; 
} 

public void setOpen(float open) { 
    this.open = open; 
} 

public float getHigh() { 
    return high; 
} 

public void setHigh(float high) { 
    this.high = high; 
} 

public float getLow() { 
    return low; 
} 

public void setLow(float low) { 
    this.low = low; 
} 

public float getItp() { 
    return itp; 
} 

public void setItp(float itp) { 
    this.itp = itp; 
} 

public void setNiftyDTO(NiftyDTO niftyDTO) { 
    this.niftyDTO = niftyDTO; 
} 

public NiftyDataDTO() { 
    super(); 
    // TODO Auto-generated constructor stub 
} 






} 

スタックトレースです:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1582) ~[spring-beans-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054) ~[spring-context-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829) ~[spring-context-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.8.RELEASE.jar:1.3.8.RELEASE] 
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760) [spring-boot-1.3.8.RELEASE.jar:1.3.8.RELEASE] 
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360) [spring-boot-1.3.8.RELEASE.jar:1.3.8.RELEASE] 
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) [spring-boot-1.3.8.RELEASE.jar:1.3.8.RELEASE] 
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.3.8.RELEASE.jar:1.3.8.RELEASE] 
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.3.8.RELEASE.jar:1.3.8.RELEASE] 
at com.socgen.portfolio.PMSApplication.main(PMSApplication.java:17) [classes/:na] 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_92] 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_92] 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_92] 
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_92] 
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na] 
    Caused by: javax.persistence.PersistenceException: [PersistenceUnit: 
    default] Unable to build Hibernate SessionFactory 
atorg.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1249) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.access$600(EntityManagerFactoryBuilderImpl.java:120) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:860) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] 
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:340) ~[spring-orm-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:319) ~[spring-orm-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1641) ~[spring-beans-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.8.RELEASE.jar:4.2.8.RELEASE] 
... 21 common frames omitted 
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown 
target entity property: com.socgen.portfolio.domain.NiftyDataDTO.nifty in com.socgen.portfolio.domain.NiftyDTO.niftyDataDTO 
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:769) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:729) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:70) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1697) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1426) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] 
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] 
... 29 common frames omitted 

2017-06-08 14:38:03.305 WARN 142244 --- [   main] o.s.boot.SpringApplication    : Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' is defined) 

Process finished with exit code 1 
+0

NiftyDataDTOには気の利いた – StanislavL

+0

を持っていませんあなたはモルになりますか?あなたは@ StanislavLを得ていない – DeathPulse

答えて

1

mappedbyが値として有効なプロパティ名を持っている必要があります。

@OneToMany(mappedBy = "niftyDTO", cascade = CascadeType.ALL, fetch = FetchType.LAZY) 
private Set<NiftyDataDTO> niftyDataDTO; 
関連する問題