I am trying to associate a post to the currently logged in user but I get errors when I try to generate entities. What I'm trying to do seems similar to examples I see online and the documentation.
https://www.jhipster.tech/user-entity/
I'm using JHipster 8 installed from npm npm install -g generator-jhipster
I tried to generate entities with the following jdl file:
entity Post {
content String,
}
/**
* One to many relationship.
*/
relationship OneToMany {
Post{user} to User
}
and got the following error:
ERROR! In the relationship between Post and User, User is not declared. If 'User' is a built-in entity declare like 'Post to User with builtInEntity'.
Following the advice from the error message I tried adding "with builtInEntity"
relationship OneToMany {
Post{user} to User with builtInEntity
}
Then I got the following error
ERROR! Error at entity Post: could not find the other side of the relationship {
"relationshipSide": "left",
"relationshipType": "one-to-many",
"otherEntityName": "user",
"relationshipName": "user",
"relationshipWithBuiltInEntity": true,
"otherEntity": "[User Entity]",
"ownerSide": false,
"otherEntityField": "id",
"relationshipLeftSide": true,
"relationshipRightSide": false,
"collection": true,
"otherSideReferenceExists": false,
"otherEntityIsEmbedded": false
}