Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create new entities that have a relationship with User #79

Closed
1 task done
JasonTypesCodes opened this issue Jun 2, 2020 · 2 comments · Fixed by #106
Closed
1 task done

Unable to create new entities that have a relationship with User #79

JasonTypesCodes opened this issue Jun 2, 2020 · 2 comments · Fixed by #106
Assignees
Labels
bug 🐞 Something isn't working

Comments

@JasonTypesCodes
Copy link
Contributor

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 JasonTypesCodes added the bug 🐞 Something isn't working label Jun 2, 2020
@erikcvisser
Copy link

erikcvisser commented Jun 7, 2020

@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>

@JasonTypesCodes JasonTypesCodes self-assigned this Jun 10, 2020
@JasonTypesCodes
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants