|
This code works by taking languages, which might be "English", "Spanish" and "Other" and puts the code in line:
Query q = em.createNativeQuery("select id from DT_Collection_Language d where d.language in ('Enlgish', 'Spanish', 'Other') ");
This code throws Exception at Runtime:
java.lang.ClassCastException: [Ljava.lang.String;
at org.hibernate.type.StringType.toString(StringType.java:44)
...
...
@NamedQuery(name="findtest", query="select a.id from DowntimeLanguage a where a.language in (?1)")
...
String[] languagesA = {"English", "Spanish", "Other"};
Query q = em.createNamedQuery("findtest");
q.setParameter(1, languagesA);
return q.getResultList();
The error is thrown at the line q.getResultList() and the query is never run (I have showSQL turned on)
|