Hello,
I am new to Hibernate and need to get something up and running quickly for a test I am doing. I am getting this error:
javax.ejb.EJBException: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: product is not mapped [FROM product p]
So I started looking around for "hibernate mapping" and took a look at the hibernate tutorial from here:
http://docs.jboss.org/hibernate/stable/ ... ml_single/The entity class it uses looks nothing like mine. I based mine on one I found on the internet, and it looks like this:
Code:
package htest.pdtest;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="product")
public class Product implements Serializable
{
private static final long serialVersionUID = 1L;
private Long m_id = -1L;
private String m_name;
public Product() {
super();
}
public Product(String name) {
super();
m_name = name;
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return m_id;
}
public void setId(Long id) {
m_id = id;
}
public String getName() {
return m_name;
}
public void setName(String name) {
m_name = name;
}
}
The one in the Hibernate tutorial has none of the annotations, but does use a mapping file. Is it the case that you either have annotations or you use a mapping file?
Thanks,
Paul