0

With this code

entity Person {
   id   String 
   name String
   post String
}

It will give me like

@Id
private String id;

@Field("name")
private String name;
@Field("post")
private String post;

but i want like

@Id
private String id;

@Field("name")
@Indexed(name = "name",unique = true)
private String name;
@Field("post")
private String post;

And this thing i have to do automatically, while importing jdl it should created automatically. How can i do that?

I read about custome annotation in jhipster but not getting how should i implement it.

  • As far as I know, custom annotations require you to write a blueprint to process them to generate the code you want. You may not want to spend this effort for something that you can easily do by modifying generated code manually. – Gaël Marziou Jun 16 '21 at 14:15

1 Answers1

0

You can do this with the validator of jdl, in your case unique.

like this:

entity Person {
   id   String,
   name String unique,
   post String
}
StepoBiz
  • 51
  • 7
  • This is useful because it adds "unique=true" on `@Column` annotation but it will not generate `@Indexed` and unfortunately the original poster did not describe from which package it came from. So we have no idea about what this annotation does. – Gaël Marziou Jun 17 '21 at 12:15