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.  [ 5 posts ] 
Author Message
 Post subject: Text Truncating in SQL Server 2000
PostPosted: Mon Nov 27, 2006 3:05 pm 
Newbie

Joined: Thu Apr 20, 2006 10:47 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 1.02

Name and version of the database you are using: SQL Server 2000

I'm trying to save a C# string type to a SQL Server Text field and am being truncated to 4000 characters every time an update occurs. I've found online that to get around this, a property attribute needs to be set on the C# property containing the data. This is an example of the code I'm looking at...

http://wiki.castleproject.org/index.php/ActiveRecord:Troubleshooting#Text_Columns_are_truncated_in_Sql_Server

I've tried the following variations of this property and each time I get a comple error stating ['Property' is not an attribute class.]

[Property(ColumnType="StringClob")]
[NHibernate.Mapping.Property(ColumnType="StringClob")]

I've also added various "using" statements in the object with no luck either which include the following...

using NHibernate.Property;
using NHibernate.Mapping;
using NHibernate.Metadata;
using NHibernate.Util;
using NHibernate.Cfg;

So my question is... What do I need to do in order for the following chunk of code to compile?

Code:
[Property(ColumnType="StringClob")]
   public String Contents
   {
       get { return _contents; }
       set { _contents = value; }
   }


Thanks,

Kyle


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 4:55 am 
Newbie

Joined: Mon Jun 05, 2006 8:51 am
Posts: 18
Try this for a change:
Code:
using NHibernate.SqlTypes;
using NHibernate.Mapping.Attributes;

[Property(typeof(StringClobSqlType))]
public String Contents
{
    get { return _contents; }
    set { _contents = value; }
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 1:18 pm 
Newbie

Joined: Thu Apr 20, 2006 10:47 am
Posts: 2
I tried that and it didn't work. The following line of code does not have an Attributes namespace and therefore errors out:

Code:
using NHibernate.Mapping.Attributes;


Additionally, the compiler is still flagging the Property attribute as not being found:

Code:
[Property(typeof(StringClobSqlType))]


The few examples I've seen online all show the fix in the format I originally posted. However, the compiler does not like the Property attribute, no matter which assembly I put in the "using" statement.

I've also used .Net Reflector to look for the Attribute class (which a class must inherit in order for it to be an attribute of a method, class, etc.) No where in the NHibernate.dll (Version 1.0.2.0) is the Attribute class referenced. So this tells me either the example code on the Internet was never tested or this class existed in an older version of NHibernate.

So is there even an work around for this bug?

Thanks,

Kyle


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 2:00 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Well that's because NHibernate.Mapping.Property is not an attribute class... You probably meant something like NHibernate.Mapping.Attributes.Property.


Top
 Profile  
 
 Post subject: Nhibernate Mappings
PostPosted: Tue Dec 26, 2006 7:20 pm 
Newbie

Joined: Tue Dec 26, 2006 7:03 pm
Posts: 2
Just to make the Segei's response more clear. NHibernate.Mapping.Attributes is a different assembly and that's why it can be accesed from the NHibernate namespace.

The assembly is contained in the Nhibernate Contrib package and must be referenced in the project to make the classes available.

So to solve the problem download the NHibernate Contrib, the package must have the same version of the NHibernate assembly so be careful.

I hope this helps


Regards
Diego


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