Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Collation speficfication at column level
PostPosted: Wed Jul 29, 2009 10:51 am 
Regular
Regular

Joined: Tue Feb 17, 2009 5:13 am
Posts: 59
Hi all.

I need to set an specific collation type for DB, so I have overwritten MySQL5InnoDBDialect class.

Code:
import org.hibernate.dialect.MySQL5InnoDBDialect;

public class CustomMysqlDialect extends MySQL5InnoDBDialect {

   public String getTableTypeString() {
        return "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci";
    }
}


But I need a lower level specification due to I have to specify another collation for id columns... Concretely utf8_bin instead of utf8_spanish_ci.

Only for one column in each table. ¿How could I do that? ¿any idea?

Thanks in advance.

_________________
Born to lose... live to win!


Top
 Profile  
 
 Post subject: Re: Collation speficfication at column level
PostPosted: Fri Jul 31, 2009 4:03 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2296
Location: Third rock from the Sun
@Column annotation?

If you need to set it "globally" like at the dialect level then you might have better chances in the hibernate core forums.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Collation speficfication at column level
PostPosted: Wed Aug 12, 2009 6:56 am 
Regular
Regular

Joined: Tue Feb 17, 2009 5:13 am
Posts: 59
Ok, I have annotated my field with @Column(name = "uuid", columnDefinition = "varchar(23) COLLATE utf8_bin")

Remaining fields use the dialect specification.

_________________
Born to lose... live to win!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.