Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use List with JDL entities in Jhipster

I'm new to use Jhipster. I want to create a JDL entity using my existing model classes. Here is my model class.

@Data
public class ResponseJson implements Serializable {
    private List<String> names;
}

Normal JDL entity can be created like,

entity ResponseJson{
  names String
}

But I need to know how to use List in JDL entities.

like image 775
RYJ Avatar asked Sep 02 '25 04:09

RYJ


1 Answers

You cannot use List directly

Instead you can create a one-to-many relationship in order to make ResponseJson have multiple String by wrapping this String in another Object

Your JDL should be:

entity ResponseJson {
    ...
}

entity ObjectContainingString {
    name String
}

relationship OneToMany {
    ResponseJson{name} to ObjectContainingString{json}
} 
like image 171
chrisdns Avatar answered Sep 05 '25 01:09

chrisdns