jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.57k stars 4.02k forks source link

Import a jdl definition which uses User entity #3977

Closed lrkwz closed 8 years ago

lrkwz commented 8 years ago
Overview of the issue

I wish to use the User entity in order to associate each User with a Customer.

JDL-Importing such a definition generates an error

$ yo jhipster:import-jdl jhipster-jdl.jh
The jdl is being parsed.
Error jhipster:import-jdl jhipster-jdl.jh 

ERROR! Error while parsing entities from JDL
[object Object]

further inspecting the error is In the relationship between User and Customer, User is not declared.

Reproduce the error
  1. yo jhipster to produce a basic project
  2. Create jhipster-jdl.jh
    relationship OneToMany{
        User{customer} to Customer
     } 
    entity Customer {

        legalName String required
        birthDate LocalDate
        vatid String
        business Boolean required
    }
  1. Import $ yo jhipster:import-jdl jhipster-jdl.jh
    JHipster Version(s)

BTW I'm quite sure it is a regression bug.

test-customer@0.0.0 /home/lrkwz/generator-jhipster-extend-user
└── generator-jhipster@3.5.1 
JHipster configuration, a .yo-rc.json file generated in the root folder
{
  "generator-jhipster": {
    "jhipsterVersion": "3.5.1",
    "baseName": "test_customer",
    "packageName": "com.mycompany.myapp",
    "packageFolder": "com/mycompany/myapp",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "no",
    "websocket": "no",
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": "no",
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "jwtSecretKey": "308c83521a7f64cc27d75631dc2d1844913fe224",
    "useSass": false,
    "applicationType": "monolith",
    "testFrameworks": [
      "gatling"
    ],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "it"
    ]
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

git version 1.9.1

node: v4.2.1

npm: 3.10.5

bower: 1.7.9

gulp: [14:40:57] CLI version 1.2.2 [14:40:57] Local version 3.9.1

yeoman: 1.7.1

Docker version 1.11.2, build b9f10c9

docker-compose version 1.7.1, build 0a9ab35

lrkwz commented 8 years ago

BTW Using

$ jhipster-uml jhipster-jdl.jh 

somehow leads to a result.

jdubois commented 8 years ago

This looks like a JDL issue -> can you move this ticket to the jhipster/jhipster-core project ?

jdubois commented 8 years ago

Closing this because this should be JDL bug -> please link to this ticket when you re-open it on jhipster/jhipster-core

lrkwz commented 8 years ago

Moved to https://github.com/jhipster/jhipster-core/issues/52

deepu105 commented 8 years ago

Relationship from User entity is not supported by JHipster and JDL and its clearly documented as well

You can only do relationships to User entity that too only many-to-one, one-to-one and many-to-many and User cannot be owner in any of these case

relationship OneToMany{
        User{customer} to Customer
     }