Closed shwabnitz closed 4 years ago
What is the correct way to extent the tenant entity? I executed:
jhipster import-jdl tenant.jdl --regenerate
and got an exception. See jdl file and output below.
entity Tenant { name String, address String, country String, zipcode String, city String, numberofusers Integer, edition Edition, expires ZonedDateTime } enum Edition { FREE, BASIC, ENTERPRISE, PREMIUM }
Screen log output:
INFO! Using JHipster version installed globally INFO! Executing import-jdl tenant.jdl INFO! Options: regenerate: true, from-cli: true, inline: INFO! Found .yo-rc.json on path. This is an existing app INFO! The JDL is being parsed. INFO! Found entities: Tenant. INFO! The JDL has been successfully parsed INFO! Generating 1 entity. 00h00m00s 0/0: : Found jhispter at <homedir>/.npm/lib/node_modules/generator-jhipster/generators Extending peer generator-jhipster version 6.7.1 at <homedir>/.npm/lib/node_modules/generator-jhipster info Using blueprint generator-jhipster-tenantview for entity subgenerator Found the .jhipster/Tenant.json configuration file, entity can be automatically generated! The entity Tenant is being updated. Not needed for 6.7.1, tenantFolderName => entityFolderName Not needed for 6.7.1, tenantFolderName => entityModelFileName info Using blueprint generator-jhipster-tenantview for entity-server subgenerator info Using blueprint generator-jhipster-tenantview for entity-client subgenerator info Using blueprint generator-jhipster-tenantview for entity-i18n subgenerator ✖ File: _Tenant.java ✖ Target: @OneToMany(mappedBy = "tenant") ✖ Match: ✖ null ✖ Body: ✖ package com.mycompany.myapp.domain; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; import java.io.Serializable; import java.time.ZonedDateTime; import com.mycompany.myapp.domain.enumeration.Edition; /** * A Tenant. */ @Entity @Table(name = "tenant") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Tenant implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "name") private String name; @Column(name = "address") private String address; @Column(name = "country") private String country; @Column(name = "zipcode") private String zipcode; @Column(name = "city") private String city; @Column(name = "numberofusers") private Integer numberofusers; @Enumerated(EnumType.STRING) @Column(name = "edition") private Edition edition; @Column(name = "expires") private ZonedDateTime expires; // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public Tenant name(String name) { this.name = name; return this; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public Tenant address(String address) { this.address = address; return this; } public void setAddress(String address) { this.address = address; } public String getCountry() { return country; } public Tenant country(String country) { this.country = country; return this; } public void setCountry(String country) { this.country = country; } public String getZipcode() { return zipcode; } public Tenant zipcode(String zipcode) { this.zipcode = zipcode; return this; } public void setZipcode(String zipcode) { this.zipcode = zipcode; } public String getCity() { return city; } public Tenant city(String city) { this.city = city; return this; } public void setCity(String city) { this.city = city; } public Integer getNumberofusers() { return numberofusers; } public Tenant numberofusers(Integer numberofusers) { this.numberofusers = numberofusers; return this; } public void setNumberofusers(Integer numberofusers) { this.numberofusers = numberofusers; } public Edition getEdition() { return edition; } public Tenant edition(Edition edition) { this.edition = edition; return this; } public void setEdition(Edition edition) { this.edition = edition; } public ZonedDateTime getExpires() { return expires; } public Tenant expires(ZonedDateTime expires) { this.expires = expires; return this; } public void setExpires(ZonedDateTime expires) { this.expires = expires; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Tenant)) { return false; } return id != null && id.equals(((Tenant) o).id); } @Override public int hashCode() { return 31; } @Override public String toString() { return "Tenant{" + "id=" + getId() + ", name='" + getName() + "'" + ", address='" + getAddress() + "'" + ", country='" + getCountry() + "'" + ", zipcode='" + getZipcode() + "'" + ", city='" + getCity() + "'" + ", numberofusers=" + getNumberofusers() + ", edition='" + getEdition() + "'" + ", expires='" + getExpires() + "'" + "}"; } } ============= Files queued to be written ========== <homedir>/data/dev/projects/jhipster/4testbest/bower.json <homedir>/data/dev/projects/jhipster/4testbest/package.json <homedir>/data/dev/projects/jhipster/4testbest/.yo-rc.json <homedir>/.yo-rc-global.json <homedir>/data/dev/projects/jhipster/4testbest/.jhipster/Tenant.json <homedir>/data/dev/projects/jhipster/4testbest/src/main/resources/config/liquibase/changelog/20200306113450_added_entity_Tenant.xml <homedir>/data/dev/projects/jhipster/4testbest/src/main/resources/config/liquibase/fake-data/tenant.csv <homedir>/data/dev/projects/jhipster/4testbest/src/main/java/com/mycompany/myapp/domain/Tenant.java <homedir>/data/dev/projects/jhipster/4testbest/src/main/java/com/mycompany/myapp/repository/TenantRepository.java <homedir>/data/dev/projects/jhipster/4testbest/src/main/java/com/mycompany/myapp/web/rest/TenantResource.java <homedir>/data/dev/projects/jhipster/4testbest/src/main/java/com/mycompany/myapp/service/TenantService.java <homedir>/data/dev/projects/jhipster/4testbest/src/test/java/com/mycompany/myapp/web/rest/TenantResourceIT.java <homedir>/data/dev/projects/jhipster/4testbest/src/test/java/com/mycompany/myapp/domain/TenantTest.java <homedir>/data/dev/projects/jhipster/4testbest/src/main/resources/config/liquibase/master.xml <homedir>/data/dev/projects/jhipster/4testbest/src/main/java/com/mycompany/myapp/config/CacheConfiguration.java <homedir>/data/dev/projects/jhipster/4testbest/src/main/java/com/mycompany/myapp/domain/enumeration/Edition.java <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant.component.html <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant-detail.component.html <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant.module.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant.route.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/shared/admin/tenant.model.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant.component.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant-detail.component.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant.service.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant-update.component.html <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant-delete-dialog.component.html <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant-update.component.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/tenant/tenant-delete-dialog.component.ts <homedir>/data/dev/projects/jhipster/4testbest/src/test/javascript/spec/app/admin/tenant/tenant-detail.component.spec.ts <homedir>/data/dev/projects/jhipster/4testbest/src/test/javascript/spec/app/admin/tenant/tenant.component.spec.ts <homedir>/data/dev/projects/jhipster/4testbest/src/test/javascript/spec/app/admin/tenant/tenant.service.spec.ts <homedir>/data/dev/projects/jhipster/4testbest/src/test/javascript/spec/app/admin/tenant/tenant-update.component.spec.ts <homedir>/data/dev/projects/jhipster/4testbest/src/test/javascript/spec/app/admin/tenant/tenant-delete-dialog.component.spec.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/admin/admin-routing.module.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/shared/model/enumerations/edition.model.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/layouts/navbar/navbar.component.html <homedir>/data/dev/projects/jhipster/4testbest/src/main/webapp/app/core/icons/font-awesome-icons.ts <homedir>/data/dev/projects/jhipster/4testbest/src/main/java/com/mycompany/myapp/domain/TenantParameter.java <homedir>/data/dev/projects/jhipster/4testbest/src/main/java/com/mycompany/myapp/aop/tenant/TenantAspect.java <homedir>/data/dev/projects/jhipster/4testbest/src/main/resources/config/liquibase/changelog/20200306113450-1__user_Tenant_constraints.xml <homedir>/data/dev/projects/jhipster/4testbest/src/main/resources/config/liquibase/changelog/20200306113450-2__tenant_user_data.xml <homedir>/data/dev/projects/jhipster/4testbest/src/main/resources/config/liquibase/data/tenant.csv <homedir>/data/dev/projects/jhipster/4testbest/src/main/resources/config/liquibase/data/tenant_user.csv <homedir>/data/dev/projects/jhipster/4testbest/src/main/resources/config/liquibase/data/tenant_authority.csv <homedir>/data/dev/projects/jhipster/4testbest/src/main/resources/config/liquibase/data/tenant_user_authority.csv ============= ========== events.js:174 throw er; // Unhandled 'error' event ^ Error: Error applying templates at Environment.error (<homedir>/.npm/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js:237:40) at module.exports.error (<homedir>/.npm/lib/node_modules/generator-jhipster/generators/generator-base.js:1515:18) at Patcher.patch (<homedir>/.npm/lib/node_modules/generator-jhipster-tenantview/node_modules/generator-jhipster-customizer/lib/patcher.js:123:28) at module.exports.applyPatcher (<homedir>/.npm/lib/node_modules/generator-jhipster-tenantview/node_modules/generator-jhipster-customizer/lib/environment.js:123:33) at Object.<anonymous> (<homedir>/.npm/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:546:23) at <homedir>/.npm/lib/node_modules/generator-jhipster/node_modules/run-async/index.js:25:25 at new Promise (<anonymous>) at <homedir>/.npm/lib/node_modules/generator-jhipster/node_modules/run-async/index.js:24:19 at self.env.runLoop.add.completed (<homedir>/.npm/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:547:9) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5) Emitted 'error' event at: at Immediate.setImmediate (<homedir>/.npm/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:559:18) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5)
A jdl example https://github.com/mshima/generator-jhipster-tenantview/blob/master/test-integration/samples/jdl-definition/app.jdl.
What is the correct way to extent the tenant entity? I executed:
jhipster import-jdl tenant.jdl --regenerate
and got an exception. See jdl file and output below.
Screen log output: