Unable to create new entities that have a relationship with `User`
JasonTypesCodes opened this issue · comments
Overview of the issue
When an entity has a relationship with User, creating a new entity through the UI fails:
Failed to convert argument [bankAccount] for value [null] due to: Cannot construct instance of `com.mycompany.myapp.domain.User` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('1') at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.mycompany.myapp.domain.BankAccount["user"])
Project configuration
application {
config {
applicationType monolith
authenticationType jwt
baseName jhipster
blueprints [generator-jhipster-micronaut]
buildTool gradle
cacheProvider ehcache
clientFramework react
clientPackageManager npm
clientTheme cyborg
clientThemeVariant dark
creationTimestamp 1590870527345
databaseType sql
devDatabaseType h2Disk
dtoSuffix DTO
embeddableLaunchScript false
enableHibernateCache true
enableSwaggerCodegen false
enableTranslation true
jhiPrefix jhi
jhipsterVersion "6.9.0"
languages [en, al, ar-ly, hy]
messageBroker false
nativeLanguage en
packageName com.mycompany.myapp
prodDatabaseType mysql
searchEngine false
serverPort 8080
serviceDiscoveryType false
skipClient false
skipServer false
skipUserManagement false
testFrameworks [protractor]
useSass true
websocket false
}
entities BankAccount, Label, Operation
}
entity BankAccount {
name String required,
balance BigDecimal required
}
entity Label {
label String required minlength(3)
}
entity Operation {
date Instant required,
description String,
amount BigDecimal required
}
relationship OneToMany {
BankAccount{operation} to Operation{bankAccount(name)}
}
relationship ManyToOne {
BankAccount{user(login)} to User
}
relationship ManyToMany {
Operation{label(label)} to Label{operation}
}
paginate Operation with infinite-scroll
- Checking this box is mandatory (this is just to show you read everything)
@JasonTypesCodes I had encountered the same issue, and was able to resolve it by changing the dropdown in the entity-update to the following. Hope this works for you as well.
<AvInput id="character-user" type="select" className="form-control" name="user.id">
<option value="" key="0" />
{users
? users.map((otherEntity) => (
<option value={otherEntity.id} key={otherEntity.id}>
{otherEntity.login}
</option>
))
: null}
</AvInput>
There is quite a bit going on here. It seems the server implementation was working with OAuth but was still leaning on non-oauth implementation of the User entity. I'm going to clean this up first and when I'm done I'll see if this is still an issue.