Community
Participate
Working Groups
Build Identifier: eclipselink-2.3.0.v20110604-r9504 Using the entity: @Entity @Table(name = "EMPLOYEE") public class Employee implements java.io.Serializable, Comparable<Employee> { private int id; private String firstName; public Employee() { } public Employee(int id, String firstName) { this.id = id; this.firstName = firstName; } // =========================================================== // getters and setters for the state fields @Id @Column(name = "ID") public int getId() { return id; } public void setId(int id) { this.id = id; } @Column(name = "FIRSTNAME") public String getFirstName() { return firstName; } ---------------- Client Code: try { Query query = em.createQuery("select e from Employee e where e.firstName = ?1"); query.getParameterValue(1); System.out.println("IllegalStateException not thrown"); } catch (IllegalStateException e) { System.out.println("Received expected IllegalStateException"); } catch (Exception e) { System.out.println("Unexpected exception occurred", e); } --------------- Output: Unexpected exception occurred java.lang.IllegalArgumentException: No paramter with name : fname1 was found within the query: ReadAllQuery(referenceClass=Employee sql="SELECT ID, FIRSTNAME FROM EMPLOYEE WHERE (FIRSTNAME = ?)"). [javatest.batch] at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getParameterValue(EJBQueryImpl.java:1437) Reproducible: Always
Updating target milestone.
IllegalArgumentException should be the expected exception according to the current version of the spec.
Created attachment 227036 [details] proposed fix
Looks like I misread the spec. Fix checked in - simply changes the exeption thrown Tested with JPA LRG
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink