jhipster/jhipster-dotnetcore

After creating an entity with command, the database does not recognize the entity.

luisferreiroo opened this issue · 5 comments

Once I have created the entity, I go to my webapp to see if the entity appears. When I see that it appears, inside the entity I get the following error: Object object. So it does not allow me to create anything inside the entity

This is shown in the log of my container

Hellang.Middleware.ProblemDetails.ProblemDetailsMiddleware[1]
An unhandled exception has occurred while executing the request.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'transmission_state'.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'transmission_Content'.

- Thats my jhipster info.

.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "Booking",
    "blueprints": [
      {
        "name": "generator-jhipster-dotnetcore",
        "version": "3.9.0"
      }
    ],
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "clientFramework": "angularX",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "cqrsEnabled": true,
    "creationTimestamp": 1666337905860,
    "databaseType": "mssql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 4200,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableTranslation": false,
    "entities": [
      "Transmission",
      "TransmissionContent",
      "TransmissionTheme",
      "TransmissionState",
      "Television",
      "TelevisionGroup"
    ],
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.8.1",
    "languages": ["en", "fr"],
    "lastLiquibaseTimestamp": 1669306907000,
    "namespace": "Booking",
    "nativeLanguage": "es",
    "otherModules": [
      {
        "name": "generator-jhipster-dotnetcore",
        "version": "3.9.0"
      }
    ],
    "packageName": "com.mycompany.myapp",
    "pages": [],
    "prodDatabaseType": "mysql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": "5000",
    "serviceDiscoveryType": false,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "skipUserManagement": false,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": true,
    "withTerraformAzureScripts": false
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Transmission {
  idTransmission Integer
  description String
  isTemplate Boolean
  plannedEndTime LocalDate
  plannedStartTime LocalDate
  realEndTime LocalDate
  idTransmissionGroup Integer
  idTransmissionState Integer
  idTransmissionContent Integer
  idUser Integer
  dateCreated LocalDate
  dateModified LocalDate
  createdBy Integer
  lastModificationBy Integer
}
entity TransmissionContent {
  idTransmissionContent Integer
  code String
  description String
  isActive Boolean
  hideOverLappingInformation Boolean
  idTransmissionTheme Integer
  dateModified LocalDate
  dateCreated LocalDate
  createdBy Integer
  lastModificationBy Integer
  ignoreOverLapping Boolean
}
entity TransmissionTheme {
  idTransmissionTheme Integer
  code String
  description String
  isActive Boolean
  dateModified LocalDate
  dateCreated LocalDate
  createdBy Integer
  lastModificationBy Integer
}
entity TransmissionState {
  idTransmissionState Integer
  state String
  dateModified LocalDate
  dateCreated LocalDate
  createdBy Integer
  lastModificationBy Integer
}
entity Television {
  idTelevision Integer
  code String
  nif String
  description String
  isActive Boolean
  isBillable Boolean
  isForta Boolean
  order Integer
  dateModified LocalDate
  dateCreated LocalDate
  createdBy Integer
  lastModificationBy Integer
  idDefaultBillingTelevision Integer
  billingOrder Integer
}
entity TelevisionGroup {
  idTelevisionGroup Integer
  code String
  description String
  isActive Boolean
  order Integer
  idTelevisionGroupType Integer
  dateModified LocalDate
  dateCreated LocalDate
  createdBy Integer
  lastModificationBy Integer
}
relationship OneToMany {
  TransmissionContent{pertenece} to Transmission{tiene(idTransmissionContent)}
  TransmissionTheme{tiene} to TransmissionContent{pertenece(idTransmissionTheme)}
  Television{pertenece} to TelevisionGroup{tiene(idTelevision)}
}


Environment and Tools

openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode)

git version 2.38.1.windows.1

node: v16.18.0

npm: 8.19.3

Docker version 20.10.20, build 9fdeb9c

Docker Compose version v2.12.0

No change to package.json was detected. No package manager install will be executed.
Congratulations, JHipster execution is complete!
Sponsored with ❤️ by @oktadev.

Hello @luisferreiroo sorry for the long delay, how did you create the entities ?

I created the entities inside a docker container using visual studio to create the entities with command, but I already have the entities I wanted using a git clone of a project. Now when I create the entities inside the container, I get this error: ✖ An error occured while running jhipster:entity-client#loadNativeLanguage
ERROR! Cannot read properties of undefined (reading 'endsWith')
TypeError: Cannot read properties of undefined (reading 'endsWith')
at module.exports.getFrontendAppName (/usr/local/lib/node_modules/generator-jhipster/generators/generator-base.js:2097:52)
at module.exports._loadEntityClientTranslations (/usr/local/lib/node_modules/generator-jhipster/generators/entity-client/index.js:195:36)
at module.exports.loadNativeLanguage (/usr/local/lib/node_modules/generator-jhipster/generators/entity-client/index.js:75:20)
at Object. (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1091:23)
at /usr/local/lib/node_modules/generator-jhipster/node_modules/run-async/index.js:49:25
at new Promise ()
at /usr/local/lib/node_modules/generator-jhipster/node_modules/run-async/index.js:26:19
at /usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1092:9
at new Promise ()
at module.exports.executeTask (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1063:12)

hello, i'm not sur to understand your problem, i have try to reproduce with your yo-rc.json and your jdl and everything run well inside a container. Can you give me more information ?

When I run the 'jhipster entityName' command, and I want to delete a field or a relationship I get the following error:

? Do you want to update the entity? This will replace the existing files for this entity, all your custom code will be
overwritten Yes, remove fields and relationships

ERROR! Cannot read properties of undefined (reading 'length')
TypeError: Cannot read properties of undefined (reading 'length')
at module.exports.askForFieldsToRemove (C:\Users\U2210053\AppData\Roaming\npm\node_modules\generator-jhipster-dotnetcore\generators\entity\prompts.js:170:104)
at Object. (C:\Users\U2210053\AppData\Roaming\npm\node_modules\generator-jhipster-dotnetcore\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:1097:23)
at C:\Users\U2210053\AppData\Roaming\npm\node_modules\generator-jhipster-dotnetcore\node_modules\run-async\index.js:49:25
at new Promise ()
at C:\Users\U2210053\AppData\Roaming\npm\node_modules\generator-jhipster-dotnetcore\node_modules\run-async\index.js:26:19
at C:\Users\U2210053\AppData\Roaming\npm\node_modules\generator-jhipster-dotnetcore\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:1098:9
at new Promise ()
at module.exports.executeTask (C:\Users\U2210053\AppData\Roaming\npm\node_modules\generator-jhipster-dotnetcore\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:1069:12)
at runLoop.add.once (C:\Users\U2210053\AppData\Roaming\npm\node_modules\generator-jhipster-dotnetcore\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:1049:14)
at Immediate. (C:\Users\U2210053\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\grouped-queue\lib\subqueue.js:48:34)

Hello @luisferreiroo, normaly this PR ( #1265) fix the issue