Hi,
In a custom finder method, I have a trouble with a date format.
My parameter in the findByResult method looks like 'Wed Apr 11 16:27:15 CEST
2001' in the client program.
I get the SQL finder's method parameter : '2001-04-11' (cf SQL log)
Where is my daytime (16:27:15) ??
Thanks for all.
----------------------------------------------------------------------------
----------------------------
----------------------------------------------------------------------------
----------------------------
Declare Finder in Home Interface :
public Collection findByResult(Date d1, Date d2) throws FinderException,
RemoteException;
Client's finder call :
Calendar c = Calendar.getInstance();
c.add(Calendar.MINUTE,this.getFrequency()*2);
Vector myVector = new
Vector(this.myResultHome.findByResult(rightNow.getTime(),c.getTime()));
Database definition :
+--------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+----------+------+-----+---------+-------+
| id | int(10) | | PRI | 0 | |
| url_id | int(10) | | | 0 | |
| result_date | datetime | YES | | NULL | |
| elapsed_time | int(10) | YES | | 0 | |
| threshold | int(10) | YES | | NULL | |
| status_code | int(4) | YES | | NULL | |
+--------------+----------+------+-----+---------+-------+
Datas:
+-----+--------+---------------------+--------------+-----------+-----------
--+
| id | url_id | result_date | elapsed_time | threshold |
status_code |
+-----+--------+---------------------+--------------+-----------+-----------
--+
| 284 | 1 | 2001-04-11 16:34:15 | 261 | 5000 |
200 |
| 285 | 1 | 2001-04-11 16:35:15 | 240 | 5000 |
200 |
| 286 | 1 | 2001-04-11 16:36:15 | 210 | 5000 |
200 |
| 287 | 1 | 2001-04-11 16:37:15 | 311 | 5000 |
200 |
| 288 | 2 | 2001-04-11 16:38:06 | 1062 | 5000 |
200 |
| 289 | 1 | 2001-04-11 16:38:15 | 1241 | 5000 |
200 |
+-----+--------+---------------------+--------------+-----------+-----------
--+
Finder definition in JAWS.XML :
...
<finder>
<name>findByResult</name>
<query>result_date between {0} and {1}</query>
<order>result_date ASC</order>
</finder>
...
<cmp-field>
<field-name>resultDate</field-name>
<column-name>result_date</column-name>
<jdbc-type>TIMESTAMP</jdbc-type>
<sql-type>DATETIME</sql-type>
</cmp-field>
Query in SQL file log :
SELECT id, result_date FROM IM_RESULT WHERE result_date between '2001-04-11'
and '2001-04-11' ORDER BY result_date ASC
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user