@Entity
@Table(name = "persons")
public class Person implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Enumerated(EnumType.STRING)
@Column(name = "occupation")
private Occupation occupation;
@Basic(optional = false)
@Column(name = "address")
private String address;
}
I am trying to persist this Object and I keep getting this Exception:
Caused by: java.lang.IllegalArgumentException: Object: com.entity.Person(id[null] occupation[null] address["Toronto"] is not a known Entity type.
I tried to look up this Exception but the explanations are way to vague for me to understand. I am kind of new to JPA
Can anyone please help me.
P.S. I do have getters and setters
Thanks in advance.
put @Entity annotation before class, and generate getters and setters for all fields... Try looking for any example/tutorial.