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.54k stars 4.02k forks source link

@embedded doesn't work with Mongodb #15524

Closed Ivanov-Alexander closed 11 months ago

Ivanov-Alexander commented 3 years ago
Overview of the issue

Hi guys, tried to generate project via JDL but got next error:

Unhandled promise rejection at:
TypeError: D:\jhipster\node_modules\generator-jhipster\generators\entity-client\templates\react\src\main\webapp\app\entities\entity-update.tsx.ejs:164
    162| <%_ relFieldNames.forEach(rel => { _%>
    163| <%_ if (rel.relationshipManyToOne || (rel.ownerSide && rel.relationshipOneToOne))  { _%>
 >> 164|         <%= rel.relationshipFieldName %>: <%= rel.otherEntityNamePlural %>.find(it => it.<%= rel.otherEntity.primaryKey.name %>.toString() === values.<%= rel.relationshipFieldName %>Id.toString()),
    165| <%_ } _%>
    166| <%_ }) _%>
    167|     }

Cannot read property 'name' of undefined
Motivation for or Use Case
Reproduce the error

jhipster jdl .\application.jdl

Related issues
Suggest a Fix
JHipster Version(s)

7.1.0

JHipster configuration

Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
D:\jhipster
`-- (empty)

cat: no such file or directory: .yo-rc.json

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
Not generated
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
     application {
  config {
        baseName missionMarketplace
        packageName com.ai
        applicationType monolith
        authenticationType session
        buildTool maven
        cacheProvider redis
        clientFramework react
        clientPackageManager npm
        clientTheme yeti
        clientThemeVariant dark
        databaseType mongodb
        devDatabaseType mongodb
        prodDatabaseType mongodb
        dtoSuffix Response
        languages []
        nativeLanguage en
        serverPort 8080
    }

    entities *
dto * with mapstruct
service * with serviceClass
paginate * with pagination
}
entity Country {
    id UUID
    name String
}
@embedded
entity Region {
    name String
}
relationship OneToOne {
    Country to Region
}
Environment and Tools

java version "11.0.9" 2020-10-20 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.9+7-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.9+7-LTS, mixed mode)

git version 2.32.0.windows.1

node: v14.15.1

npm: 7.18.1

Docker version 20.10.7, build f0df350

docker-compose version 1.29.2, build 5becea4c

No change to package.json was detected. No package manager install will be executed.

Entity configuration(s) entityName.json files generated in the .jhipster directory

Not generated

Browsers and Operating System

OS Name Microsoft Windows 10 Pro Version 10.0.19043 Build 19043

Ivanov-Alexander commented 3 years ago

image

mshima commented 3 years ago

Need to change line:

<%_ if (rel.relationshipManyToOne || (rel.ownerSide && rel.relationshipOneToOne))  { _%>

to

<%_ if (rel.relationshipManyToOne || (rel.ownerSide && rel.relationshipOneToOne && !rel.otherEntity.embedded))  { _%>

We don’t have support to embedded entities in the frontend.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days

mraible commented 2 years ago

@Ivanov-Alexander Is this still an issue with 7.6.0?

mshima commented 2 years ago

This probably still happens to vue and react. There are a few fixes to angular embedded support at https://github.com/jhipster/generator-jhipster/pull/17822

github-actions[bot] commented 12 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days