jhipster / generator-jhipster-micronaut

Micronaut blueprint for JHipster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for OneToOne relationship with jpaDerivedIdentifier

JasonTypesCodes opened this issue · comments

Overview of the issue

While adding entity configurations for #199, I have hit an error with the following JDL:

relationship OneToOne {
  Employee{user(login)} to User with jpaDerivedIdentifier
}

I suspect this may be an issue with Micronaut Data or Hibernate, but some more research is needed to be sure. I wanted to log this as a separate issue as not to hold up #213 longer than needed.

Reproduce the error

Generate a project with provided JDL and run ./mvnw integration-test

Project configuration
JDL definitions
     // Inspired by: https://github.com/jhipster/generator-jhipster/blob/main/test-integration/samples/jdl-default/app.jdl

application {
config {
applicationType monolith
baseName jhipsterSampleApplication
blueprints [generator-jhipster-micronaut]
packageName tech.jhipster.sample
authenticationType jwt
prodDatabaseType postgresql
buildTool maven
searchEngine false
testFrameworks []
clientFramework angularX
enableTranslation true
nativeLanguage en
languages [ en, fr ]
}
entities *
}

entity Bank {
bankNumber Integer
}
entity BankAccount {
name String required
bankNumber Integer
agencyNumber Long
lastOperationDuration Float
meanOperationDuration Double
balance BigDecimal required
openingDay LocalDate
lastOperationDate Instant
active Boolean
accountType BankAccountType
attachment AnyBlob
description TextBlob
}
entity TheLabel {
labelName String required minlength(3)
}
entity Operation {
date Instant required
description String
amount BigDecimal required
}

enum BankAccountType {
CHECKING (checking_account),
SAVINGS (savings_account),
LOAN (loan_account)
}

entity Department {
name String required,
description TextBlob,
advertisement Blob,
logo ImageBlob
}

/**

  • JobHistory comment.
    */
    entity JobHistory {
    startDate ZonedDateTime,
    endDate ZonedDateTime,
    language Language
    }

enum Language {
FRENCH, ENGLISH, SPANISH
}

enum JobType {
BOSS, SLAVE
}

entity Job {
title String minlength(5) maxlength(25),
type JobType,
minSalary Long,
maxSalary Long
}

/**

  • The Employee entity.
  • Second line in javadoc.
    /
    entity Employee {
    /
    *
    • The firstname attribute.
      */
      firstName String,
      lastName String,
      email String,
      phoneNumber String,
      hireDate ZonedDateTime,
      salary Long,
      commissionPct Long
      }

entity Location {
streetAddress String,
postalCode String,
city String,
stateProvince String
}

entity Task {
title String,
description String
}

entity GoldenBadge {
name String
}

entity SilverBadge {
name String
}

entity Identifier {
name String required unique
}

entity Country {
name String
}

entity Region {
name String
}

relationship OneToOne {
Department{location} to Location,
Employee{user(login)} to User with jpaDerivedIdentifier
}

relationship OneToMany {
BankAccount{operation} to Operation{bankAccount(name)}
}
relationship ManyToOne {
BankAccount{user(login)} to User
}
relationship ManyToMany {
Operation{theLabel(labelName)} to TheLabel{operation}
}

relationship OneToMany {
/**

  • A relationship
    /
    Department{employee} to
    /
    *
  • Another side of the same relationship,
    */
    Employee{department},
    Employee{job} to Job{emp(lastName)},
    Location{country} to Country,
    Country{area(name)} to Region
    }

relationship ManyToOne {
Employee{manager(lastName)} to Employee,
Employee{sibag(name) required} to SilverBadge,
Employee{gobag(name) required} to GoldenBadge,
SilverBadge{iden(name) required} to Identifier,
GoldenBadge{iden(name) required} to Identifier
}

relationship ManyToMany {
JobHistory{department} to Department{history},
JobHistory{job} to Job{history},
JobHistory{emp(firstName)} to Employee{history},
Job{chore(title)} to Task{linkedJob(title)},
Bank{bankAccount} to BankAccount{bank}
}

dto BankAccount, Employee, Department, Location, Country, Region, SilverBadge, GoldenBadge, Identifier with mapstruct

angularSuffix BankAccount with mySuffix
// filter BankAccount, Employee
clientRootFolder BankAccount, TheLabel, Operation with test-root

paginate TheLabel, Job with pagination
paginate Operation, JobHistory, Employee with infinite-scroll

service TheLabel, Employee, Department, Region with serviceClass
service BankAccount, Location, Country with serviceImpl

  • Checking this box is mandatory (this is just to show you read everything)