[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-725) hbm2java generate wrong type for hibernate type "timestamp"

wanhing (JIRA) noreply at atlassian.com
Wed Aug 9 18:53:19 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-725?page=comments#action_23884 ] 

wanhing commented on HBX-725:
-----------------------------

But this is not the documented behaviour. According to Hibernate documentation, hibernate timestamp is mapped to  java.sql.Timestamp, which has nano value. Millisec might be enough for most but not enough for some (including us), that's why Java has java.sql.Timestamp. Also if both hibernate date and timestamp map to java Date, then why bother to have hibernate "timestamp" type?


> hbm2java generate wrong type for hibernate type "timestamp"
> -----------------------------------------------------------
>
>          Key: HBX-725
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-725
>      Project: Hibernate Tools
>         Type: Bug

>   Components: hbm2java
>     Versions: 3.2beta6
>  Environment: Window XP, java 1.4.2
>     Reporter: wanhing

>
>
> When I use "timestamp" in the mapping definition file, the generated java class has "Date" instead. As a result I lost the granuity that I need. Example:
> ====================================================================
>   <class name="TaskDuration">
>     <meta attribute="class-description">
>       @jboss-net.xml-schema urn="tms:TaskDuration"
>     </meta>
>     <id name="id" column="TaskDurationId" type="long" >
>       <generator class="native"/>
>     </id>
>     <version name="version" />    
>         
>     <property name="datetime"   type="timestamp" not-null="true"/>
>     <property name="duration"   type="float"     not-null="true"/>
>  </class>
> =====================================================================
> The generated java class has:
> public class TaskDuration  implements java.io.Serializable {
>  ....
>      private Date datetime;
>     public void setDatetime(Date datetime) {
>         this.datetime = datetime;
>     }
>     public Date getDatetime() {
>         return this.datetime;
>     }
>  ...
> }

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list