I have a UserBean Java class class with a list of events:
@OneToMany private List<EventBean> events;
EventBean has a Date variable:
@Temporal(javax.persistence.TemporalType.TIMESTAMP) private Date eventDate;
Now in UserBean I want to create a NamedQuery that returns all dates that belong to a specific range:
@NamedQuery(name="User.findEventsWithinDates", query="SELECT u.events FROM UserBean u WHERE u.name = :name AND u.events.eventDate > :startDate AND u.events.eventDate < :endDate")
The above query does not compile. I get this error:
The state field path 'u.events.eventDate' cannot be resolved to a valid type.
By the way, I am using EclipseLink version 2.5.0.v20130507-3faac2b.
What can I do to make this request work? Thanks.
jpa eclipselink jpql named-query
user473453
source share