I am learning Entity Beans and
EJB QL and have come across the following dilemna. I have a legacy relational db some of whose columns are
Java type java.sql.Date. I created an Entity Bean to manage persistence with this table. I created a ejbSelectMethod with the query SELECT OBJECT(b) FROM Booking AS b WHERE b.fld1 = ?1 AND b.fld2 = ?2 AND bl.fld3 = ?3. fld1 and fld2 are strings, but fld3 is type java.sql.Date, and reading Monson-Haefel's Enterprise JavaBeans 4th Ed., I learned that you can't use java.util.Date/java.sql.Date objects in equality comparisons, rather, you must compare dates in long/millis form. I tried defining a CMP field of type long in my Entity bean, but my EJB container won't let me deploy it because the CMP field doesn't have a counterpart in the db table (my EJB container has a vendor-specific deployment descriptor for mapping CMP fields to db columns). Monson-Haefel says you must persist the date in long form rather than Date form, but modifying the definition of my legacy table is not an option. Is there something I can do with my Entity bean CMP fields and/or methods that will allow me to the EJB QL query indicated (with "fld3= ?3" being a comparison of longs)?