-->
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.  [ 3 posts ] 
Author Message
 Post subject: Versioned updated chokes on leap seconds.
PostPosted: Thu Aug 05, 2010 9:57 am 
Beginner
Beginner

Joined: Wed Dec 10, 2008 5:59 am
Posts: 47
Hey,

I keep running into a problem which i just can't figure out how to get around.

I've got an entity Track:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="com.tracker.robot.db.entities.Track" table="track">
    <id column="id" length="36" name="id" type="java.lang.String">
      <generator class="com.tracker.robot.db.generator.CustomUUIDGenerator"/>
    </id>

    <version column="updated" name="updated" type="java.util.Calendar" unsaved-value="null" generated="always" />
    [....]
</hibernate-mapping>


I try to do an versioned update of this entity using HQL:
Code:
Query q = currentSession.createQuery("update Track t set t.flag = :flag where t.id = :id");


This works most of the time. However, the query is "converted" to SQL using [...] set t.flag = [value], t.updated=updated+1. Now, this is the root of the issue. Somehow, MySQL throws an exception here whenever the 'updated' field ends with 59 (the 59th second of a minute). The next second would be 0 in the subsequent minute. However, MySQL doesn't handle this and throws an exception.

Does anyone have any ideas about how i can solve this? Do i need to modify the MySQL dialect and have it to use for instance NOW() instead of just adding one to the existing update value.

All help would be highly appreciated!


Top
 Profile  
 
 Post subject: Re: Versioned updated chokes on leap seconds.
PostPosted: Thu Aug 05, 2010 10:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
For dates it should not be using "t.updated=updated+1", it should be using something like "t.updated=current_timestamp()". I have to believe this is a misunderstanding about field type. Open a JIRA bug with a simplified test case and I'll take a look


Top
 Profile  
 
 Post subject: Re: Versioned updated chokes on leap seconds.
PostPosted: Mon Aug 09, 2010 4:06 am 
Beginner
Beginner

Joined: Wed Dec 10, 2008 5:59 am
Posts: 47
Hi,

Thanks for your reply steve. I have opened a JIRA issue.

URL: http://opensource.atlassian.com/project ... e/HHH-5449


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.