名前付きクエリが表示されない理由がわかりません。誰かがそれに光を当ててくれることを願っています:
ここにコードがあります:
@Data
@Entity
@Table(name = "shipments")
@NamedNativeQueries({
@NamedNativeQuery(name = "byShipmentNumber", query = "select S.SHIPMENTS_ID,S.SHIPMENT_NUMBER,S.COMPANIES_ID, S.COMPANIES_ID_3,(min(sil.IMPORT_PCT)) MIN_PCT,(max(sil.IMPORT_PCT)) MAX_PCT,"
+ "(case when ((nvl((SUM(case when (nvl(SIL.IMPORT_PCT,0)>0) then 1 end)),0)) < count(nvl(SIL.IMPORT_PCT,0))) then 0 else 1 end) Status from SHIPMENTS s "
+ "join shipment_invoices si on s.shipments_id = si.shipments_id"
+ "join SHIPMENT_INVOICE_LINES sil on SI.SHIPMENT_INVOICES_ID = sil.SHIPMENT_INVOICES_ID"
+ "where s.SHIPMENT_NUMBER = :shipmentNumber"
+ "and companies_id=23351763"
+ "group by S.SHIPMENTS_ID,S.SHIPMENT_NUMBER,S.COMPANIES_ID, S.COMPANIES_ID_3;",
resultClass = Shipments.class)
})
public class Shipments implements Serializable {
@Id
@Column(name = "shipments_id")
private Long id;
@Column(name = "shipment_number")
private String shipmentNumber;
@Column(name = "companies_id")
private String billTo;
@Column(name = "companies_id_3")
private String issuer;
@Column(name = "status")
private String status;
@Column(name = "min_pct")
private String minImportCost;
@Column(name = "max_pct")
private String maxImportCost;
public static List<Shipments> getShipmentByShipmentNumber(Session session, String shipmentNumber) {
Query query = session.getNamedQuery("byShipmentNumber");
query = query.setString("shipmentNumber", shipmentNumber);
return query.list();
}
ここにエラーがあります:
SEVERE: Servlet.service() for servlet [appServlet] in context with path [/ImportCost.spring] threw exception [Request processing failed; nested exception is org.hibernate.MappingException: Named query not known: byShipmentNumber] with root cause
org.hibernate.MappingException: Named query not known: byShipmentNumber