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: Problem mapping Timestamp
PostPosted: Tue Sep 22, 2009 11:25 am 
Newbie

Joined: Tue Sep 22, 2009 10:01 am
Posts: 2
Hi,

I'm new here and relatively new to hibernate. I have datetime column that I mapped to java.sql.Date. The problem is that it doesn't have date component. I tried changing to java.sql.Timestamp and it works but objects that I'm getting on the client side are of type SybTimestamp (apparently sybase implementation of timestamp). It's important not not have sybase JAR on the client. Is it possible to force hibernate to use java.sql.Timestamp and not sybase implementation?

Thanks,
Bane


Top
 Profile  
 
 Post subject: Re: Problem mapping Timestamp
PostPosted: Mon Sep 28, 2009 5:59 am 
Newbie

Joined: Tue Sep 22, 2009 10:01 am
Posts: 2
I kinda solved the problem by converting timestamp to java.util.Date when hibernate sets the value

Code:
        @Column(name = "created_on", nullable = false)
   @Type(type = "java.util.Date")
   public Date getCreatedOn() {
      return createdOn;
   }

   public void setCreatedOn(Date createdOn) {
      this.createdOn = new Date(createdOn.getTime());
   }


cheers


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.