Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self referenced entities generated using JDL import error on Angular 4 #6063

Closed
scepanovicmarko opened this issue Jul 8, 2017 · 4 comments
Closed
Milestone

Comments

@scepanovicmarko
Copy link

Executing jhipster:info
Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
alt-test-app-ang-4@0.0.0 /Users/markoscepanovic/Documents/Alt36/AltTestAppAng4
└── generator-jhipster@4.6.0

JHipster configuration, a .yo-rc.json file generated in the root folder
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.alt36",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "4.6.0",
    "baseName": "AltTestAppAng4",
    "packageName": "com.alt36",
    "packageFolder": "com/alt36",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "jwtSecretKey": "7174c7a4e2c35623ab11cc88cb723782c9759b5d",
    "clientFramework": "angularX",
    "useSass": false,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en"
    ]
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
entity Region (region) {
  regionName String
}
entity Country (country) {
  countryName String
}
/**
 * not an ignored comment
 */
entity Location (location) {
  streetAddress String,
  postalCode String,
  city String,
  stateProvince String
}
entity Department (department) {
  departmentName String required
}
/**
 * Task entity.
 * @author The JHipster team.
 */
entity Task (task) {
  title String,
  description String
}
/**
 * The Employee entity.
 */
entity Employee (employee) {
  /**
   * The firstname attribute.
   */
  firstName String,
  lastName String,
  email String,
  phoneNumber String,
  hireDate ZonedDateTime,
  salary Long,
  commissionPct Long
}
entity Job (job) {
  jobTitle String,
  minSalary Long,
  maxSalary Long
}
entity JobHistory (job_history) {
  startDate ZonedDateTime,
  endDate ZonedDateTime,
  language Language
}

enum Language {
  FRENCH,
  ENGLISH,
  SPANISH
}

relationship OneToOne {
  Country{region} to Region,
  Location{country} to Country,
  Department{location} to Location,
  JobHistory{job} to Job,
  JobHistory{department} to Department,
  JobHistory{employee} to Employee
}
relationship OneToMany {
  /**
   * A relationship
   */
  Department{employee} to Employee{department},
  Employee{job} to Job{employee}
}
relationship ManyToOne {
  Employee{manager} to Employee
}
relationship ManyToMany {
  Job{task(title)} to Task{job}
}

dto Region with mapstruct
service Region with serviceImpl
angularSuffix Region with mySuffix
dto Country with mapstruct
service Country with serviceImpl
angularSuffix Country with mySuffix
dto Location with mapstruct
service Location with serviceImpl
angularSuffix Location with mySuffix
dto Department with mapstruct
service Department with serviceImpl
angularSuffix Department with mySuffix
dto Task with mapstruct
service Task with serviceImpl
angularSuffix Task with mySuffix
dto Employee with mapstruct
paginate Employee with infinite-scroll
angularSuffix Employee with mySuffix
dto Job with mapstruct
paginate Job with pagination
angularSuffix Job with mySuffix
dto JobHistory with mapstruct
paginate JobHistory with infinite-scroll
service JobHistory with serviceImpl
angularSuffix JobHistory with mySuffix
Browsers and Operating System

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

git version 2.13.2

node: v6.11.0

npm: 3.10.10

bower: 1.8.0

gulp:
[14:35:57] CLI version 1.3.0

yeoman: 2.0.0

yarn: 0.24.6

@scepanovicmarko
Copy link
Author

error:

ERROR in ./src/main/webapp/app/entities/employee/employee-my-suffix-dialog.component.ts
Module parse failed: /Users/markoscepanovic/Documents/Alt36/AltTestAppAng4/node_modules/angular2-template-loader/index.js!/Users/markoscepanovic/Documents/Alt36/AltTestAppAng4/node_modules/awesome-typescript-loader/dist/entry.js!/Users/markoscepanovic/Documents/Alt36/AltTestAppAng4/node_modules/tslint-loader/index.js!/Users/markoscepanovic/Documents/Alt36/AltTestAppAng4/src/main/webapp/app/entities/employee/employee-my-suffix-dialog.component.ts Argument name clash (20:108)
You may need an appropriate loader to handle this file type.
| var department_1 = require("../department");
| var EmployeeMySuffixDialogComponent = (function () {
| function EmployeeMySuffixDialogComponent(activeModal, alertService, employeeService, departmentService, employeeService, eventManager) {
| this.activeModal = activeModal;
| this.alertService = alertService;
@ ./src/main/webapp/app/entities/employee/index.ts 9:9-57
@ ./src/main/webapp/app/entities/employee/employee-my-suffix.module.ts
@ ./src/main/webapp/app/entities/entity.module.ts
@ ./src/main/webapp/app/app.module.ts
@ ./src/main/webapp/app/app.main.ts

ERROR in [at-loader] ./src/main/webapp/app/entities/employee/employee-my-suffix-dialog.component.ts:9:10
TS2300: Duplicate identifier 'EmployeeMySuffix'.

ERROR in [at-loader] ./src/main/webapp/app/entities/employee/employee-my-suffix-dialog.component.ts:11:10
TS2300: Duplicate identifier 'EmployeeMySuffixService'.

ERROR in [at-loader] ./src/main/webapp/app/entities/employee/employee-my-suffix-dialog.component.ts:13:10
TS2300: Duplicate identifier 'EmployeeMySuffix'.

ERROR in [at-loader] ./src/main/webapp/app/entities/employee/employee-my-suffix-dialog.component.ts:13:28
TS2300: Duplicate identifier 'EmployeeMySuffixService'.

ERROR in [at-loader] ./src/main/webapp/app/entities/employee/employee-my-suffix-dialog.component.ts:33:17
TS2300: Duplicate identifier 'employeeService'.

ERROR in [at-loader] ./src/main/webapp/app/entities/employee/employee-my-suffix-dialog.component.ts:35:17
TS2300: Duplicate identifier 'employeeService'.

@deepu105
Copy link
Member

deepu105 commented Jul 8, 2017

I think we need to exclude adding imports and service if the relationship is with same entity

@yingw
Copy link
Contributor

yingw commented Jul 11, 2017

I got the same issue, as deepu said , just remove the link of Employee(manager) to itself, then the import will go well. Wish jhispter fix it asap.

remove this:
relationship ManyToOne { Employee{manager} to Employee }

@stieler-it
Copy link
Contributor

This error also occurs when importing the sample initially loaded in JDL Studio

@deepu105 deepu105 marked this as a duplicate of #6129 Jul 16, 2017
@jdubois jdubois modified the milestone: 4.6.2 Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants