0

I'm using jhipster-generator 4.14.5 and im trying to generate an Entity with a field Persons. But Persons is a List of String List<String> Persons.

How can i achieve it in JHipster. I tried to generate a simple field as String, then i changed the POJO like this :

@ElementCollection
@Column(name="persons")
List<String> persons;

The domain.json containing the whole table remain not touched.

I tried to run the application, after running liquibase:diff, without success. How can i fix it?

3logy
  • 2,634
  • 8
  • 46
  • 99

1 Answers1

0

Use the generator entity to create a relationship : Create an entity Person (maybe with only the "name", but more fields will soon be needed. Like "active", some dates ...)

.jhipster/[YourEntity].json should contain :

"fields": [
    {
        "fieldName": "xxx",
        "fieldType": "Integer"
    }
],
"relationships": [
    {
        "relationshipName": "person",
        "otherEntityName": "person",
        "relationshipType": "one-to-many",
        "relationshipValidateRules": [
            "required"
        ],
        "otherEntityField": "name"
    }
],

don't forget to commit before using the generator. Maybe you will need multiple executions to get it right.

  • thank you for the answer. Actually i don't want a List but a list of String. But like Jon Rudell said it's impossible per default right now. But i will accept your answer as a workaround. – 3logy Aug 22 '18 at 07:49