与用户的多对多关系

时间:2016-07-12 04:57:24

标签: jhipster

是否可以与用户建立多对多关系?我试图建立一个简单的实体

{
    "relationships": [
        {
            "relationshipName": "leader",
            "otherEntityName": "user",
            "relationshipType": "many-to-many",
            "otherEntityField": "login",
            "ownerSide": true
        },
        {
            "relationshipName": "member",
            "otherEntityName": "user",
            "relationshipType": "many-to-many",
            "otherEntityField": "login",
            "ownerSide": true
        }
    ],
    "fields": [
        {
            "fieldName": "name",
            "fieldType": "String"
        }
    ],
    "changelogDate": "20160712043251",
    "dto": "mapstruct",
    "service": "no",
    "entityTableName": "team",
    "pagination": "no"
}

但是当我从列表中选择用户并选择保存时会出现错误

  

org.springframework.dao.InvalidDataAccessApiUsageException:org.hibernate.TransientObjectException:    object引用未保存的瞬态实例 - 在刷新之前保存瞬态实例:   com.mycompany.myapp.domain.User;嵌套异常是java.lang.IllegalStateException:   org.hibernate.TransientObjectException:object引用未保存的瞬态实例 - 在刷新之前保存瞬态实例:com.mycompany.myapp.domain.User

是否可以在jhipster中与用户建立这种关系?

1 个答案:

答案 0 :(得分:1)

目前Jhipster不支持,请查看此问题:https://github.com/jhipster/generator-jhipster/issues/3827