-->
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: Schema export for SQL server
PostPosted: Thu Aug 19, 2004 4:53 am 
Newbie

Joined: Thu Aug 19, 2004 4:35 am
Posts: 1
Hibernate version: 2.1.6 (stable)

Name and version of the database you are using: Microsoft SQLServer 2000 Version 8.00.194 (RTM)

The schema export generates "varbinary(xxx)" if the mapping document specifies "serializable" for a particular field. In SQL server varbinary has a limit of 8000 bytes (less if there is more data on the row). In order to store more than this, the data type should to be "IMAGE" instead of "varbinary(xxx)". After having a quick look at the data type definitions for the dialects, the following modification to SQLServerDialect.java does the trick for me.

Since I am a hibernate newbie, I don't know whether this has other side effects. Anyway, IMHO this may be something that potentially could make it's way into the hibernate source.

Note: Data access on manually created tables that use "serializable" <-> "image" mapping do work without the patch nice and smoothly.

Cheers!

Andy

-------------

andy@earth:~> diff download/hibernate-2.1/src/net/sf/hibernate/dialect/SQLServerDialect.java eclipse/workspace/hibernate-2.1/src/net/sf/hibernate/dialect/SQLServerDialect.java
3a4,5
> import java.sql.Types;
>
9c11,16
<
---
> public SQLServerDialect() {
> super();
> registerColumnType( Types.VARBINARY, "image" );
> registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
> }
>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2004 5:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please submit patches to JIRA, or they will get lost.


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.