У меня есть эта ошибка в моем коде:
"Request processing failed; nested exception is javax.persistence.PersistenceException:
org.hibernate.exception.SQLGrammarException: could not extract ResultSet] con causa raíz
com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-206,
SQLSTATE=42703, SQLERRMC=INVOICESEL2_.CODE_K, DRIVER=4.14.88"
Я не могу найти ошибку, я знаю, что код SQL -206 ссылается на объект указан в контексте, где это не такдействительный.
Мой код такой:
public InvoiceSeller getSellerByEmail(String email, String debtorCode) {
String qString = "SELECT d FROM " + InvoiceSeller.class.getSimpleName() + " d "
+ " INNER JOIN "+ InvoiceSellerContact.class.getSimpleName() + " sc "
+ " ON d.code = sc.invoiceSeller.code AND d.invoiceDebtor.code = sc.invoiceSeller.invoiceDebtor.code "
+ " INNER JOIN "+ Contact.class.getSimpleName() + " c ON sc.contact.id = c.id "
+ " INNER JOIN " + ActiveRegisterMaster.class.getSimpleName() + " a "
+ " ON d.code = a.code AND d.invoiceDebtor.code = a.invoiceDebtor "
+ " WHERE a.tableName = :tablename AND d.invoiceDebtor.code = :debtorCode "
+ " AND c.email = :email AND d.status = :status";
TypedQuery<InvoiceSeller> query = this.em.createQuery(qString, InvoiceSeller.class);
System.out.println(qString);
System.out.println(query.getFirstResult());
query.setParameter("debtorCode", debtorCode);
query.setParameter("email", email);
query.setParameter("tablename", InvoiceSeller.TABLENAME);
query.setParameter("status", "A");
InvoiceSeller seller = query.getSingleResult();
System.out.println(seller.toString());
return seller;
}
Спасибо!