是什么导致EntityType.java:677上的Hibernate无限循环?

是什么导致EntityType.java:677上的Hibernate无限循环?,hibernate,infinite-loop,Hibernate,Infinite Loop,运行Hibernate 4.3.5,我在这里得到一个无限循环,导致StackOverflower错误: org.hibernate.type.EntityType.getIdentifierOrUniqueKeyType(EntityType.java:677) 所讨论的方法是: public final Type getIdentifierOrUniqueKeyType(Mapping factory) throws MappingException { if ( isReferen

运行Hibernate 4.3.5,我在这里得到一个无限循环,导致StackOverflower错误:

org.hibernate.type.EntityType.getIdentifierOrUniqueKeyType(EntityType.java:677)
所讨论的方法是:

public final Type getIdentifierOrUniqueKeyType(Mapping factory) throws MappingException {
    if ( isReferenceToPrimaryKey() || uniqueKeyPropertyName == null ) {
        return getIdentifierType(factory);
    }
    else {
        Type type = factory.getReferencedPropertyType( getAssociatedEntityName(), uniqueKeyPropertyName );
        if ( type.isEntityType() ) {
            type = ( ( EntityType ) type).getIdentifierOrUniqueKeyType( factory );
        }
        return type;
    }
}

以前有没有人遇到过这个问题,或者知道是什么原因导致了这个问题?

我找到了答案,我已经在两端建立了两个一对一的关系:

<one-to-one name="payment" property-ref="invoice" lazy="proxy" />
<one-to-one name="invoice" property-ref="payment" lazy="proxy" />

将Hibernate发送到无限循环中。我将在Hibernate上查看是否有关于此问题的错误报告,因为似乎不可能添加对此的检查和更好的错误消息

将关系的一端替换为:

<many-to-one name="payment" column="payment_id" unique="true" lazy="proxy" />

解决了这个问题