The JAWS mapping you are using must map a java.util.Date to a
java.sql.Date, and SQL dates do not have a time component. Change the
mapping to a java.sql.Timestamp (Timestamp in fact extends from
java.util.Date), and the time component of the date will be saved:
Your jaws.xml or standardjaws.xml should contain:
<mapping>
<java-type>java.util.Date</java-type>
<jdbc-type>TIMESTAMP</jdbc-type>
<sql-type>DATETIME</sql-type> <!-- or whatever for your
database -->
</mapping>
Alex
|--------+-------------------------------------->
| | Felix Munoz |
| | <[EMAIL PROTECTED]> |
| | Sent by: |
| | [EMAIL PROTECTED]|
| | eforge.net |
| | |
| | |
| | 07/30/01 11:24 AM |
| | Please respond to jboss-user|
| | |
|--------+-------------------------------------->
>-----------------------------------------------------------------------------------------------------|
|
|
| To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]> |
| cc:
|
| Subject: [JBoss-user] Date field saved to DB with no time
|
>-----------------------------------------------------------------------------------------------------|
All:
I am using this code to set the modification time field of an EJB:
Person person = personHome.findByPrimaryKey(personPK);
.
.
.
if (modified)
{
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
Date currentTime = calendar.getTime();
person.setLastModificationTime(currentTime);
}
When presenting the "lastModificationTime" field in a JSP right after
setting it, this value is written with the correct hour, minute, and second
values (e.g. 07/30/01 10:56:32 AM). However, if I restart the server (i.e.
clear the objects and re-create them from the DB), the
"lastModificationTime" field will be written with hour, minute and second
set to 0 (e.g. 07/30/01 00:00:00 AM).
Any ideas?
Thanks in advance!
Felix
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user