I am trying to map a NativeQuery to a Entity, there is no table exisiting, the query creates the resultset through a lot of joins.
The example is the following :
Code:
@Entity
@SqlResultSetMappings( {
@SqlResultSetMapping(
name="TechSpecs",
entities={
@EntityResult(
entityClass=TechSpecs.class
)
}
)
})
public class TechSpecs {
//@PersistenceContext
//transient EntityManager entityManager;
@EmbeddedId
public TechSpecsPK getId() {
return id;
}
... all the POJO Stuff
I am filling this object with
Code:
Query q = em.createNativeQuery(query,"TechSpecs");
During the unittest , all works fine, but during the startup of the webapplication Hibernate crashes because he tries to find the table for this entity ... Why does this keep happening ????