Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNeo4J: Cyclic OneToMany adds an incorrect ManyToOne #11691
Comments
|
Thanks @jkransen for reporting this and being brave using the neo4j support. Just to make sure, the generated entity contains both the |
|
Hi @atomfrede , indeed I want to give Neo4J a try. At least I can learn something about it along the way. I will be glad to give more feedback knowing that it will be picked up. Maybe a few small steps on the road to get rid of that beta tag :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview of the issue
Neo4J generation
Cyclic Relationship to entity itself results in second, incorrect property.
Motivation for or Use Case
I want a Person to have friends as a collection of type Person.
Reproduce the error
Generate application based on this. Generated domain class:
Also, some additional code is generated based on this, including CRUD in the front end.
Related issues
This similar issue was related to React, and Neo4J was not used back then:
#11549
Suggest a Fix
Do not generate the reverse relationship in a OneToMany to type itself for Neo4J.
JHipster Version(s)
6.8.0
JHipster configuration
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.blabla",
"nativeLanguage": "en"
},
"jhipsterVersion": "6.8.0",
"applicationType": "monolith",
"baseName": "blabla",
"packageName": "com.blabla",
"packageFolder": "com/blabla",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "ehcache",
"enableHibernateCache": false,
"websocket": false,
"databaseType": "neo4j",
"devDatabaseType": "neo4j",
"prodDatabaseType": "neo4j",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSwaggerCodegen": false,
"jwtSecretKey": "",
"embeddableLaunchScript": false,
"useSass": true,
"clientPackageManager": "npm",
"clientFramework": "angularX",
"clientTheme": "minty",
"clientThemeVariant": "primary",
"creationTimestamp": 1588343391509,
"testFrameworks": ["cucumber"],
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"enableTranslation": true,
"nativeLanguage": "en",
"languages": ["en"],
"blueprints": [],
"herokuAppName": "blabla",
"herokuDeployType": "jar"
}
}
If you have a JDL please wrap it in below structure
JDL definitions
Entity configuration(s)
entityName.jsonfiles generated in the.jhipsterdirectoryHere, Person is called Trainer. I think I already see the problem. There is a ManyToOne after the OneToMany that should probably go. I checked, and it is not in the jhipster-jdl.jh
{
"name": "Trainer",
"fields": [
{
"fieldName": "name",
"fieldType": "String"
},
{
"fieldName": "code",
"fieldType": "Long"
},
{
"fieldName": "level",
"fieldType": "Integer"
},
{
"fieldName": "xp",
"fieldType": "Integer"
},
{
"fieldName": "team",
"fieldType": "Team",
"fieldValues": "VALOR,MYSTIC,INSTINCT"
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "trainer",
"otherEntityRelationshipName": "trainer",
"relationshipName": "friends"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "trainer",
"otherEntityRelationshipName": "friends",
"relationshipName": "trainer",
"otherEntityField": "id"
}
],
"changelogDate": "20200502070200",
"entityTableName": "trainer",
"dto": "no",
"pagination": "no",
"service": "serviceImpl",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"clientRootFolder": "",
"applications": "*"
}
Browsers and Operating System
Linux Mint 19