package org.udg.pds.simpleapp_javaee.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

@Entity
// This tells JAXB that it has to ignore getters and setters and only use fields for JSON marshaling/unmarshaling
public class Tag implements Serializable {
  /**
   * Default value included to remove warning. Remove or modify at will.
   **/
  private static final long serialVersionUID = 1L;

  public Tag() {
  }

  public Tag(String name, String description) {
    this.name = name;
    this.description = description;
  }

  // This tells JAXB that this field can be used as ID
  // Since XmlID can only be used on Strings, we need to use LongAdapter to transform Long <-> String
  @Id
  // Don't forget to use the extra argument "strategy = GenerationType.IDENTITY" to get AUTO_INCREMENT
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  @NotNull
  private String name;

  @NotNull
  private String description;

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public Long getId() {
    return id;
  }
}

@@ -38,16 +38,224 @@
 model;%0A%0A
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;%0Aimport org.udg.pds.simpleapp_javaee.rest.serializer.JsonDateSerializer;%0Aimport org.udg.pds.simpleapp_javaee.rest.serializer.JsonTagSerializer;%0A%0A
 import j
@@ -465,16 +465,64 @@
 zable;%0A%0A
+@JsonSerialize(using = JsonTagSerializer.class)%0A
 @Entity%0A
@@ -1522,11 +1522,83 @@
  id;%0A  %7D
+%0A%0A    public String getDescription() %7B%0A        return description;%0A    %7D
 %0A%7D%0A

Add custom serializer. Add getter for description