SERVLET
@EJB(name=”T2FacadeLocal”)
private T2FacadeLocal t2fl;
public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
T2 t2 = new T2(“hello”);
t2fl.save(t2); // I get a null point exception here
BEAN
@Entity
@SequenceGenerator(name=”t2_sequence”, sequenceName = “t2_seq”)
public class T2 {
private static final long serialVersionUID = -2L;
private Long id;
private String x;
public T2(String x) {
this.x = x;
}
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = “t2_sequence”)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public int hashCode() {
return (this.id == null) ? 0 : this.id.hashCode();
}
public boolean equals(Object object) {
if (object instanceof T2) {
final T2 obj = (T2) object;
return (this.id != null) ? this.id.equals(obj.id)
: (obj.id == null);
}
return false;
}
public String getX() {
return x;
}
public void setX(String x) {
this.x = x;
}
}