We had similar problems. We used named query, with a list of enum values in an IN :param form. Every time we run the code, it was initially running ok, but after the first run it was giving a exception:
Caused by: <openjpa-2.0.0-r422266:935683 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: The specified parameter of type "class hu.volksbank.bookingmanagement.domain.enums.BookingStatus" is not a valid query parameter. After a lot of fiddling around, we have found a solution: set query.setFirstResult(), and query.setMaxResults() on the Query object, it will fix the problem.ű NOTE !!: when you set a maxResult of Integer.MAX_VALUE, the above solution doesn't work. I haven't tried what's the actual max value you can set, but for me a value of 10 000 000 worked fine. KZoli -- View this message in context: http://openjpa.208410.n2.nabble.com/jira-Created-OPENJPA-1750-Prepared-query-with-enum-parameter-fails-when-query-is-cached-tp5351377p5752431.html Sent from the OpenJPA Developers mailing list archive at Nabble.com.