Java AnnotationException:@OneToOne或@ManyToOne在MySchema$Parent.propertyX上引用未知实体:MySchema$Child

Java AnnotationException:@OneToOne或@ManyToOne在MySchema$Parent.propertyX上引用未知实体:MySchema$Child,java,hibernate,corda,Java,Hibernate,Corda,我是R3科达的新手。我一直被困在这个问题中。我花了好几个小时试图解决这个问题。我在运行节点时遇到HibernateAnnotationException。这是我的模式声明文件NewIndicationSchema.java package com.myproject.schema; import com.google.common.collect.ImmutableList; import net.corda.core.schemas.MappedSchema; import net.cord

我是R3科达的新手。我一直被困在这个问题中。我花了好几个小时试图解决这个问题。我在运行节点时遇到Hibernate
AnnotationException
。这是我的模式声明文件
NewIndicationSchema.java

package com.myproject.schema;

import com.google.common.collect.ImmutableList;
import net.corda.core.schemas.MappedSchema;
import net.corda.core.schemas.PersistentState;
import org.hibernate.annotations.Cascade;

import javax.persistence.*;
import org.hibernate.annotations.CascadeType;
import java.util.Date;

/**
 * The family of schemas for NewIndication.
 */
public class NewIndicationSchema extends MappedSchema {
    public NewIndicationSchema() {
        super(NewIndicationSchema.class, 1, ImmutableList.of(Indication.class));
    }

    @Entity
    @Table(name = "new_indications", uniqueConstraints = {@UniqueConstraint(columnNames = "indicationNo")})
    public static class Indication extends PersistentState {
        @Column(name = "_id", unique = true, nullable = false) private final String _id;
        @Column(name = "indicationNo") private final String indicationNo;
        @Column(name = "status") private final String status;
        @Column(name = "effDate") private final Date effDate;
        @Column(name = "programID") private final String programID;

        @OneToOne(fetch = FetchType.LAZY, targetEntity = Insured.class)
        /*@JoinColumns(@JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id"))*/
        @Cascade(value = CascadeType.PERSIST)
        private final Insured insured;

        public Indication(Indication indication){
            this._id = indication.get_id();
            this.indicationNo = indication.getIndicationNo();
            this.status = indication.getStatus();
            this.insured = indication.getInsured();
            this.effDate = indication.getEffDate();
            this.programID = indication.getProgramID();
        }

        public String get_id() {
            return _id;
        }

        public String getIndicationNo(){
            return this.indicationNo;
        }

        public String getStatus(){
            return this.status;
        }

        public Date getEffDate(){
            return this.effDate;
        }

        public Insured getInsured(){
            return this.insured;
        }

        public String getProgramID() {
            return programID;
        }
    }

    @Entity
    @Table(name = "insureds")
    class Insured {

        @OneToOne(mappedBy = "new_indications")
        private final Indication indication;
        @Column(name = "name") private final String name;
        @Column(name = "dba") private final String dba;
        @Column(name = "city") private final String city;
        @Column(name = "address1") private final String address1;
        @Column(name = "address2") private final String address2;
        @Column(name = "state") private final String state;
        @Column(name = "zip") private final String zip;

        public Insured(Indication indication, String name, String address1, String address2, String city, String state, String zip, String dba) {
            this.indication = indication;
            this.name = name;
            this.dba = dba;
            this.address1 = address1;
            this.address2 = address2;
            this.city = city;
            this.state = state;
            this.zip = zip;
        }
        // Getters
        public Indication getIndication() {
            return indication;
        }
        public String getName(){
            return this.name;
        }
        public String getDba(){
            return this.dba;
        }
        public String getAddress1(){
            return this.address1;
        }
        public String getAddress2(){
            return this.address2;
        }
        public String getCity(){
            return this.city;
        }
        public String getState(){
            return this.state;
        }
        public String getZip(){
            return this.zip;
        }
    }
}
我可以毫无例外地构建,但是当我尝试运行节点时,我会在节点的命令提示符上记录以下错误。我一直在互联网上尝试所有的解决方案,但没有一个与
Corda
相关。所有这些都只与
Hibernate
相关。我觉得我缺少了来自Corda的任何特殊注释,或者我对模式的思考方式是错误的。请帮帮我

    E 02:01:26+0530 [main] internal.Node.run - Exception during node startup {}
     org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.myproject.schema.NewIndicationSchema$Indication.insured references an unknown entity: com.myproject.schema.NewIndicationSchema$Insured
            at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:97) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
            at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processEndOfQueue(InFlightMetadataCollectorImpl.java:1752) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
            at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processFkSecondPassesInOrder(InFlightMetadataCollectorImpl.java:1696) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
            at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1583) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
            at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:278) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
            at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
            at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
            at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
            at net.corda.nodeapi.internal.persistence.HibernateConfiguration.buildSessionFactory(HibernateConfiguration.kt:105) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.HibernateConfiguration.makeSessionFactoryForSchemas(HibernateConfiguration.kt:63) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.HibernateConfiguration.access$makeSessionFactoryForSchemas(HibernateConfiguration.kt:26) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.HibernateConfiguration$sessionFactoryForSchemas$1.apply(HibernateConfiguration.kt:44) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.HibernateConfiguration$sessionFactoryForSchemas$1.apply(HibernateConfiguration.kt:26) ~[corda-node-api-3.2-corda.jar:?]
            at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source) ~[?:1.8.0_181]
            at net.corda.nodeapi.internal.persistence.HibernateConfiguration.sessionFactoryForSchemas(HibernateConfiguration.kt:44) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.HibernateConfiguration.<init>(HibernateConfiguration.kt:40) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2$1.invoke(CordaPersistence.kt:64) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2$1.invoke(CordaPersistence.kt:51) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:136) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:124) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:131) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2.invoke(CordaPersistence.kt:63) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2.invoke(CordaPersistence.kt:51) ~[corda-node-api-3.2-corda.jar:?]
            at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130) ~[kotlin-stdlib-1.1.60.jar:1.1.60-release-55 (1.1.60)]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.getHibernateConfig(CordaPersistence.kt) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.getEntityManagerFactory(CordaPersistence.kt:67) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.DatabaseTransaction$sessionDelegate$1.invoke(DatabaseTransaction.kt:31) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.DatabaseTransaction$sessionDelegate$1.invoke(DatabaseTransaction.kt:16) ~[corda-node-api-3.2-corda.jar:?]
            at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130) ~[kotlin-stdlib-1.1.60.jar:1.1.60-release-55 (1.1.60)]
            at net.corda.nodeapi.internal.persistence.DatabaseTransaction.getSession(DatabaseTransaction.kt) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.node.services.network.PersistentNetworkMapCache$start$$inlined$synchronized$lambda$1.invoke(PersistentNetworkMapCache.kt:99) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.services.network.PersistentNetworkMapCache$start$$inlined$synchronized$lambda$1.invoke(PersistentNetworkMapCache.kt:75) ~[corda-node-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:136) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:124) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:131) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.node.services.network.PersistentNetworkMapCache.start(PersistentNetworkMapCache.kt:99) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.internal.AbstractNode$start$4.invoke(AbstractNode.kt:207) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.internal.AbstractNode$start$4.invoke(AbstractNode.kt:105) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.internal.AbstractNode$initialiseDatabasePersistence$2.invoke(AbstractNode.kt:685) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.internal.AbstractNode$initialiseDatabasePersistence$2.invoke(AbstractNode.kt:105) ~[corda-node-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.inTopLevelTransaction(CordaPersistence.kt:152) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:138) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:124) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:131) ~[corda-node-api-3.2-corda.jar:?]
            at net.corda.node.internal.AbstractNode.initialiseDatabasePersistence(AbstractNode.kt:684) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.internal.Node.initialiseDatabasePersistence(Node.kt:345) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:206) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.internal.Node.start(Node.kt:359) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:145) ~[corda-node-3.2-corda.jar:?]
            at net.corda.node.internal.NodeStartup.run(NodeStartup.kt:115) [corda-node-3.2-corda.jar:?]
            at net.corda.node.Corda.main(Corda.kt:13) [corda-node-3.2-corda.jar:?]
E 02:01:26+0530[main]internal.Node.run-节点启动期间出现异常{}
org.hibernate.AnnotationException:@OneToOne或@ManyToOne on com.myproject.schema.NewIndicationSchema$Indication.insurated引用未知实体:com.myproject.schema.NewIndicationSchema$insurated
在org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:97)~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
在org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processEndOfQueue(InFlightMetadataCollectorImpl.java:1752)~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
在org.hibernate.boot.internal.InFlightMetadataCollectorImpl.ProcessFKSSecondPasseNorder(InFlightMetadataCollectorImpl.java:1696)~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
在org.hibernate.boot.internal.InFlightMetadataCollectorImpl.ProcessSecondPass(InFlightMetadataCollectorImpl.java:1583)~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
在org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:278)~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
在org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
在org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
在org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
在net.corda.nodeapi.internal.persistence.HibernateConfiguration.buildSessionFactory(HibernateConfiguration.kt:105)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.HibernateConfiguration.makeSessionFactoryForSchemas(HibernateConfiguration.kt:63)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.HibernateConfiguration.access$makeSessionFactoryForSchemas(HibernateConfiguration.kt:26)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.HibernateConfiguration$sessionFactoryForSchemas$1.apply(HibernateConfiguration.kt:44)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.HibernateConfiguration$sessionFactoryForSchemas$1.apply(HibernateConfiguration.kt:26)~[corda-node-api-3.2-corda.jar:?]
在java.util.concurrent.ConcurrentHashMap.computeIfAbsent(未知源)~[?:1.8.0_181]
在net.corda.nodeapi.internal.persistence.HibernateConfiguration.sessionFactoryForSchemas(HibernateConfiguration.kt:44)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.HibernateConfiguration.(HibernateConfiguration.kt:40)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2$1.invoke(CordaPersistence.kt:64)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2$1.invoke(CordaPersistence.kt:51)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:136)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:124)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:131)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2.invoke(CordaPersistence.kt:63)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.CordaPersistence$hibernateConfig$2.invoke(CordaPersistence.kt:51)~[corda-node-api-3.2-corda.jar:?]
在kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)~[kotlin-stdlib-1.1.60.jar:1.1.60-release-55(1.1.60)]
在net.corda.nodeapi.internal.persistence.CordaPersistence.getHibernateConfig(CordaPersistence.kt)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.CordaPersistence.getEntityManagerFactory(CordaPersistence.kt:67)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.DatabaseTransaction$sessionDelegate$1.invoke(DatabaseTransaction.kt:31)~[corda-node-api-3.2-corda.jar:?]
在net.corda.nodeapi.internal.persistence.DatabaseTransaction$sessionDelegate$1.invoke(DatabaseTransaction.kt:16)~[corda-node-api-3.2-corda.jar:?]
在kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)~[kotlin-stdlib-1.1.60.jar:1.1.60-release-55(1.1.60)]
在net.corda.nodeapi.internal.persistence.DatabaseTransaction.getSession(DatabaseTransaction.kt)~[corda-node-api-3.2-corda.jar:?]
在net.corda.node.services.network.PersistentNetworkMapCache$start$$inlined$synchronized$lambda$1.invoke(PersistentNetworkMapCache.kt:99)~[corda-node-3.2-corda.jar:?]
位于net.corda.node.services.network.PersistentNetworkMapCache$start$$inl
super(NewIndicationSchema.class, 1, ImmutableList.of(Indication.class, Insure.class));