-->
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.  [ 4 posts ] 
Author Message
 Post subject: how to set sql-type with annotations
PostPosted: Mon Oct 24, 2005 2:21 pm 
Newbie

Joined: Thu Sep 08, 2005 2:14 pm
Posts: 7
annotations 3.1 beta6
hibernate 3.1 rc2

Hi,

I try to use the native sql-type uniqueidentifier of ms sql server as id with annotations.
I am able to generate the correct guid in the required format:
Code:

   @Id(generator="system-guid")
   @GenericGenerator(name="system-guid", strategy ="guid")
   public String getId(){
      return this.id;
   }
   protected void setId(String id) {
      this.id = id;
   }


But the column type in the table defnition of the database is varchar instead of uniqueidentifier.

Is there a way to force hibernate to use uniqueidentifier as column type?
Something like the sql-type property for annotations?

Thanks in advance

Nils


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 5:42 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
@Type
let me know if it works fine on id property

_________________
Emmanuel


Top
 Profile  
 
 Post subject: RE: @Type
PostPosted: Wed Oct 26, 2005 7:46 am 
Newbie

Joined: Thu Sep 08, 2005 2:14 pm
Posts: 7
Dear Emmanuel,

from what I unnderstood from the docs,
@Type is used for custom user type declaration. But I just need my String be mapped to the uniqueidentifier SQL-Type.

In xml mapping files I could define something like:
Code:
<property name="someGuid" type="string">
    <column name="someGuid" sql-type="uniqueidentifier"/>
</property>


Could you please give me an example how an equivalent @Type def should look like, if I want a custom sql-type="uniqueidentifier".
I searched and read through the docs, queried the forum, but could not found any example.


best regards

Nils


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 4:24 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
oups, wrong answer.
use @Column(columnDefinition="...")

_________________
Emmanuel


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