ParameterRecognitionException: Mixed parameter strategies - use just one of named, positional or JPA-ordinal strategy in JBoss EAP 7+
Issue
We are migrating our application from JBoss EAP 6 to EAP 7 / 8 and getting this exception with our JPA application:
ERROR [org.jboss.as.ejb3.invocation] (default task-3) WFLYEJB0034: Jakarta Enterprise Beans Invocation failed on component BatchHeaderDAOImpl for method public abstract java.util.List com.jboss.examples.ExampleDAO.findAllByXY(java.lang.String,java.lang.String): javax.ejb.EJBTransactionRolledbackException: org.hibernate.engine.query.ParameterRecognitionException: Mixed parameter strategies - use just one of named, positional or JPA-ordinal strategy
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:219)
...
at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:81)
at com.jboss.examples.ExampleDAO$$$view1.findAllByXY(Unknown Source)
...
Caused by: javax.persistence.PersistenceException: org.hibernate.engine.query.ParameterRecognitionException: Mixed parameter strategies - use just one of named, positional or JPA-ordinal strategy
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
...
Caused by: org.hibernate.engine.query.ParameterRecognitionException: Mixed parameter strategies - use just one of named, positional or JPA-ordinal strategy
at org.hibernate.engine.query.spi.ParamLocationRecognizer.mixedParamStrategy(ParamLocationRecognizer.java:103)
at org.hibernate.engine.query.spi.ParamLocationRecognizer.complete(ParamLocationRecognizer.java:63)
at org.hibernate.engine.query.spi.ParameterParser.parse(ParameterParser.java:214)
...
Our JPA Application is using a native query such as:
@Inject
EntityManager entityManager;
public List<MyObject> findAllByXY(String X, String Y) {
String q = "SELECT * FROM mytable WHERE x=:x And y in (?1)";
Query batchHeaderQuery = entityManager.createNativeQuery(q, MyObject.class);
...
}
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 8
- 7
- JPA
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.