1

I have the following HQL query:

SELECT ita.invoiceType, ita.agreementNumber, itr.ruleCategory 
FROM InvoiceTypeAgreements ita, InvoiceTypeRules itr 
WHERE ita.invoiceType = itr.invoiceType 
AND ita.agreementNumber IN (?1) 
AND itr.ruleCategory IN (?2)

I'm using query.getResultList() to get the values back from this. I assume it is returning an ArrayList<String[]> but whenever I try to access the String[]'s in the ArrayList<String[]> I get this error:

java.util.concurrent.ExecutionException: javax.ejb.EJBException:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;

Is an ArrayList<String[]> not what the HQL query is returning?

1 Answer 1

2

As you can see in the error message, you get List<Object[]> and not of String. The resulting values are not necessarily strings (perhaps they are in your example, but generally they aren't).

Sign up to request clarification or add additional context in comments.

1 Comment

I see. It needs to be an array of objects and then I need to cast each individual object a String. It works now. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.