From: <leg...@at...> - 2003-07-15 18:28:43
|
The following issue has been updated: Updater: Will Glass-Husain (mailto:wg...@fo...) Date: Tue, 15 Jul 2003 1:27 PM Comment: code, data, properties to duplicate this bug Changes: Attachment changed to testdate.zip --------------------------------------------------------------------- For a full history of the issue, see: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-194&page=history --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-194 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-194 Summary: Property type "date" sqltype "TIMETAMP" saves date only Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Assignee: Reporter: Will Glass-Husain Created: Tue, 15 Jul 2003 1:25 PM Updated: Tue, 15 Jul 2003 1:27 PM Environment: MySql 3.23.53, MySqlConnector J 3.0.8, JDK 1.3.1, Win XP Description: When saving a date, only the date is saved, not the time. // create the record Session session1 = sessionfactory.openSession(); AccessLog al = new AccessLog(); Date d = new Date(); Log.info("Date generated by Java: " + d); al.setAccessDate(d); session1.save(al); session1.flush(); session1.connection().commit(); Long AccessLogId = al.getAccessLogId(); session1.close(); // retrieve the record Session session2 = sessionfactory.openSession(); AccessLog al2 = (AccessLog) session2.load(AccessLog.class,AccessLogId); session2.close(); Log.info("Date retrieved from database: " + al2.getAccessDate()); <class name="com.wgh.AccessLog" table="access_log" > <id name="AccessLogId" column="ACCESS_LOG_ID" type="long"> <generator class="identity"/> </id> <property name="AccessDate" type="date"> <column name="ACCESS_DATE" sql-type="TIMESTAMP"/> </property> </class> create table access_log ( ACCESS_LOG_ID BIGINT NOT NULL AUTO_INCREMENT, ACCESS_DATE TIMESTAMP, primary key (ACCESS_LOG_ID) ); Produces: INFO Date generated by Java: Tue Jul 15 11:22:31 PDT 2003 INFO Date retrieved from database: 2003-07-15 See attached test code. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |