on 08-13-2006 6:21 AM
HI ALL,
I got a question about EJB CMP develpment.
Let say I created a table with Java dictionary as follows
column name: ID, built-in type: String
column name: PR_DATE, built-in type: date
column name: DESC, built-in type: String
Then I develop a EJB-CMP as follows:
CMP field: id, type: java.lang.String
CMP field: prDate, type: java.util.Date
CMP field: desc, type: java.lang.String
And I want to develop and findByPrDate Method:
java.util.Collection findByPrDate(java.util.Date)
EJB-QL: select object(p) from PRBean p where p.prDate = ?1
The problem is when I deploy the EJB, it got the warning:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Reason: Clusterwide exception: server ID 19282450:com.sap.engine.services.ejb.exceptions.deployment.ORMappingVerificationException: The Java type of the cmp-field that is stored in column PR_DATE, table WPR_PR_TBL does not fit to the JDBC type DATE of the column. The expected JDBC type is TIMESTAMP. The acceptable JDBC types for the columns in which the cmp-fields of CMPBeans are stored are described in the O/R mapping requirements.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Since I read the documentation that if a date field appear in EJB-QL, the type must be java.util.Date, but seems if using java.util.Date as CMP field and the table is using 'date', then will give above error.
Anyone encounter this before and any solution?
Thanks a lot !
Kelvin
Hi,
Accroding to http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBQL6.html
<i>Date and time values are in milliseconds and use a Java long. A date or time literal should be an integer literal. To generate a millisecond value, you may use the java.util.Calendar class.
</i>
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
java.util.Date is not supported, you have to use java.sql.Date for all date fields
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Don't know if it helps but try java.sql.Date instead of java.util.Date
Good luck, Roelof
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.