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?

4

1 回答 1

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.

于 2018-08-21T02:28:32.273 回答