I am receiving an error from Hibernate when I attempt to query using a NameNativeQuery. The error is:
Code:
SQL Error: 0, SQLState: 42703
The column name id10_0_ was not found in this ResultSet
Here is an example of the Domain Object that I am attempting to query:
Code:
@SqlResultSetMapping(name="getStatusSummary", entities={
@EntityResult(entityClass=StatusSummary.class, fields={
@FieldResult(column="id", name="s_id"),
@FieldResult(column="numThings", name="s_numThings")
})
})
@NamedNativeQuery(name="getStatusSummary", resultSetMapping="statusSummary",
query="select s.id as s_id, s.numThings as s_numThings from Status s")
@Entity
public class Status {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private long id;
private long numThings;
// Additional fields
}
Here is the StatusSummary class:
Code:
@Entity
public class StatusSummary implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private long id;
private long numThings;
}
Here is the code that generates the error:
Code:
Query query = em.createNamedQuery("getStatusSummary");
List results = query.getResultList();
Error occurs when getResultList() is called.
Anybody have a potential reason why this error would be occurring?