0

in Spring boot, I have an entity called Event. All the fields from the entity needs to come from user. I want that this entity should contain a field called approval status. This field doesn't need input from user but during display of that entity need that field populated from some source(from approval table) and displayed along with other fields of entity. Is there a way, I can include this field in Event class itself and specify no input or the only way is to create a wrapper class wrapping Event and approval status field?

Thanks,

Meen639
  • 77
  • 1
  • 9

1 Answers1

0

@Transient is the exact thing which fulfill your use case.

Make field transient in your entity class and then set it in controller from whatever source you want to, and display it in page.

See https://stackoverflow.com/a/42753469/6572971

Alien
  • 15,141
  • 6
  • 37
  • 57
  • When I send the class to collect input from swagger, then I dont want the field approval status to go because user is not supposed to enter this information, but when I send the class for display purpose, then I want this field to be sent across with data populated from different table. I went through your link, but I am not sure if this use case is covered....Trying your solution however.. – Meen639 Jul 05 '20 at 02:13