CMP and Dates


EJB design: CMP and Dates

  1. CMP and Dates (3 messages)

    Hi all,

    I'm a heavy user of dates (without time). My problem is that from the beginning of my Java life I've used an extended DateTime class instead of JDK's Calendar and Date (in many cases these seemed too illogical to me, a lot of extra functions, but with a lot of coding for a simplest using). This worked very fine in plain Java, and in BMP too. Now I'm trying CMP's capabilities, and I see that it handles only JDK's Date classes (or Serializable classes, which doesn't allow effective finding methods).
    Is there any Pattern or solution to handle this problem in CMP?

    My first thoughts are...

    1. create a java.sql.TimeStamp as an abstract field for CMP, but in the interfaces create setXXXDate(MyDateClass date), which implementation calls the bean's setXXXTimeStamp(TimeStamp t) method?

    2. forget CMP and make it in BMP... (anyway as far as I know in EJB QL there isn't any Date handling methods yet, which makes this solution more favourable).

    Thanks, Ivan

    Threaded Messages (3)

  2. hellow[ Go to top ]

  3. CMP and Dates[ Go to top ]

    I convert dates to "long" for use with CMP.

    Number of milliseconds from 1970.

    Works fine me and can be used in EJB QL.
  4. CMP and Dates[ Go to top ]

    First thanks for your comment.

    You mean you have a long field instead of any kind of Date field in the entity bean? How do your set/get methods look like?