in my spring boot / hibernate application, I have a data access class "CusttableDao":
import com.mycompany.myproduct.data.models.Custtable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Repository
@Transactional
public class CusttableDao {
static final Logger LOG = LoggerFactory.getLogger(CusttableDao.class);
public void update(Custtable custtable) {
entityManager.merge(custtable);
return;
}
public Custtable getById(Class<Custtable> class1, CusttableCompositeKey custtableCompositeKey) {
Custtable ct = entityManager.find(Custtable.class, custtableCompositeKey);
LOG.debug("customer.ct.accountNum: " + ct.getAccountnum());
return entityManager.find(Custtable.class, custtableCompositeKey);
}
@PersistenceContext
private EntityManager entityManager;
}
When it comes to executing the getById method, I get this error:
org.hibernate.MappingException: Unknown entity: com.mycompany.myproduct.data.models.Custtable
at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:1096)
at org.hibernate.internal.SessionImpl.locateEntityPersister(SessionImpl.java:2565)
Here is the actual Custtable definition, which has the proper @Entity annotation:
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Transient;
import com.mycompany.myproduct.data.models.CusttableCompositeKey;
@SuppressWarnings("serial")
@Entity
public class Custtable implements java.io.Serializable {
What should I change / add to avoid this error?