I am trying to do something similar like below.
@Entity
@Table(name="Sample")
public record Sample(Integer id, String name) {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="user_id")
private Integer id;
@Column(name="username")
private String name;
}
However, it gives me error "User declared non-static fields id are not permitted in a record" and same for name field as well.
Is there a way to use new java feature "record" with JPA annotation?