-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: MySQL CURRENT_TIMESTAMP usage with timestamp version tags
PostPosted: Mon Mar 30, 2009 8:02 am 
Newbie

Joined: Mon Mar 30, 2009 7:47 am
Posts: 2
MySQL CURRENT_TIMESTAMP usage with timestamp version tags,
with generated="insert" generated="always" and source="db" source="vm" attributes.

Hibernate version: 3
MySQL 5
Code between Inserts and Updates

---Currently Working--- (But Have a look at what I would like)
MySQL DDL:
`createDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',

Mapping documents:
<timestamp name="updatedDate" column="updatedDate" source="db" generated="never" />
<property name="createDate" type="java.util.Date" generated="insert" update="false">
<column name="createDate" length="0" not-null="true" />
</property>

---What I would Like To Work---
MySQL DDL:
`createDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updatedDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,

Mapping documents: NON Current DTD Compliant
<timestamp name="updatedDate" column="updatedDate" source="db" generated="always" />
<property name="createDate" type="java.util.Date" generated="insert" source="db" update="false">
<column name="createDate" length="0" not-null="true" />
</property>


---Other Options---
a) ???
<timestamp name="createDate" column="createDate" source="db" generated="insert" />
<version name="updatedDate" type="timestamp" unsaved-value="null" generated="always" source="db" />

b) problems on updates
<timestamp name="createDate" column="createDate" source="db" generated="never" /> <!-- Y -->
<property name="updatedDate" type="java.util.Date" generated="always">
<column name="updatedDate" length="0" not-null="true" />
</property>


Top
 Profile  
 
 Post subject: MySQL functions: CURDATE(), CURTIME(), and NOW()
PostPosted: Fri Apr 03, 2009 5:55 pm 
Newbie

Joined: Mon Mar 30, 2009 7:47 am
Posts: 2
MySQL functions: CURDATE(), CURTIME(), and NOW() - under Hibernate hbm.xml

How to use these functions is also the answer i am looking for?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.