on 03-15-2010 2:18 PM
I'm facing with problem regarding using java.util.Date in JPQL query.
Here are sample entities for test case:
@Embeddable
public class EmbCompTest implements Serializable{
private static final long serialVersionUID = 1L;
@Temporal(TemporalType.DATE)
private Date beginPeriod;
@Temporal(TemporalType.DATE)
private Date endPeriod;
// getters and setters goes here (...)
}
@Entity
@Table(name="TEST_DATE")
@NamedQueries(
{
@NamedQuery(name="getByDate",query="select e from TestDate e where e.beginDate=:beginDatePm"),
@NamedQuery(name="getByDate2",query="select e from TestDate e where e.emb.beginPeriod=:beginPeriodPm")
}
)
public class TestDate {
private static final long serialVersionUID = 6651720114733319974L;
@Id
private Long id;
@Temporal(TemporalType.DATE)
private Date beginDate;
@Temporal(TemporalType.DATE)
private Date endDate;
@Embedded
private EmbCompTest emb;
// getters and setters goes here (...)
}
The problem is in named query getByDate2 which causes persistence unit fail to start with exception
Caused by: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Method must not be called with
argument "java.util.Date" or "java.util.Calendar"
Is that some SAP JPA limitation that makes unable to query by date defined in @Embeddable classes ?
Of course query getByDate works fine.
Best Regards
Daniel
Hi,
a patch will be available with the releases 7.11 SP 5 and 7.20 SP 3 of the NetWeaver Java EE Server.
-Adrian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
the query getByDate2 is OK and should work. This looks like a bug to me. If you have access to OSS, please file a ticket on BC-JAS-PER-JPA.
Have you tried typing beginPeriod with java.sql.Date. This might work. (I have not tried).
-Adrian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.