Reputation: 1072
Testing is not passing in the following code. Debugging shows the error is in the creation of the query.
java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Catalog is not mapped [SELECT c FROM Catalog c WHERE c.name = :name]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1347)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1288)
Entity class:
@Entity
@Table(name = "eb_catalog", uniqueConstraints=@UniqueConstraint(columnNames="name"))
public class Catalog implements ICatalog, Serializable {
and the query itself:
TypedQuery<Catalog> query = em.createQuery(
"SELECT c FROM Catalog c WHERE c.name = :name", Catalog.class)
.setParameter("name", catName);
CTRL + click on Catalog is opening the entity, so the name matches the entity in the query.
thanks in advance.
Upvotes: 4
Views: 15400
Reputation: 527
You may have forgotten to map your entity class in the persistence.xml
.
Take a look :)
Upvotes: 10