-->
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.  [ 1 post ] 
Author Message
 Post subject: Override org.hibernate.mapping.Column.getSqlType()
PostPosted: Wed Nov 10, 2010 6:24 am 
Newbie

Joined: Wed Nov 10, 2010 6:12 am
Posts: 1
Does anybody know a way to override the method getSqlType(...) in Column class from a Dialect class.

I have implmented a Dialect class for HSQLDB and I have a column defined like this:
@Column(columnDefinition = "nvarchar(max)")
private String code;

When Hibernate goes through this method it returns nvarchar and this data type is not supported by HSQLDB.

public String getSqlType(Dialect dialect, Mapping mapping) throws HibernateException {
return sqlType==null ?
dialect.getTypeName( getSqlTypeCode(mapping), getLength(), getPrecision(), getScale() ) :
sqlType;
}

I can't simply remove the Column annotation because for some tests we are directly accessing a real database using DbUnit and it fails because Hibernate is returning varchar(255) when there is no columnDefinition defined and I get a wrong data type exception.


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

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.