package test3_persistence; import javax.annotation.PostConstruct; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.NamedQuery; @Entity @NamedQuery(name = "findxg", query = "SELECT b FROM test_class b WHERE b.title ='xg'") public class test_class { @Id @GeneratedValue private Long id; @PostConstruct public void ps (){ title = "xg"; } private String title; private Double price; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } }