简体   繁体   中英

JSON not returning columns in Spring Data REST / MySQL

I am starting to build a REST API with spring data rest but the JSON object returned in my first testing does not return the column names and just returns the links to the objects.

ENTITY:

@Data
@Entity
public class Employee {

private @Id @GeneratedValue Long id;
private String name;
private String email;

private Employee() {}

public Employee(String name, String email) {
    this.name = name;
    this.email = email;
}
}

REPOSITORY:

public interface EmployeeRepository extends CrudRepository<Employee, Long>{

}

REQUEST / RESPONSE:

REQUEST / RESPONSE

I tried to remove the lombok @Data since I read it in a similar post but it didnt work. I´m using MySQL as database.

Thanks in advance!

Okay guys, I solved the problems by creating getters and setter manually. If anyone knows how to be able to use Lombok please share with all:).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM