-->
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.  [ 3 posts ] 
Author Message
 Post subject: Microsoft Sql server ntext problem
PostPosted: Fri Jan 20, 2006 1:12 pm 
Newbie

Joined: Fri Jan 20, 2006 12:48 pm
Posts: 6
When I try to write to a table with a field of type ntext, some string size of 100KB, all that has been written is string of 4kB. I know about a restriction but I dont know to remove it. Please help.

Hibernate version:1.0.1.0

Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Accordia.DataLayer.Configuration.AppRssCatalog, DataLayer" table="app_rss_catalog">

<id name="AppRssCatalogId" column="app_rss_catalog_id" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<property column="rss_catalog_time_to_live" type="Int32" name="RssCatalogTimeToLive" />
<!-- this feeld is a problem--><property column="rss_catalog" type="String" name="RssCatalog" not-null="true" length="1073741823" />
<property column="currnetly_avaible" type="Boolean" name="CurrnetlyAvaible" not-null="true" />
<property column="last_time_refershed" type="DateTime" name="LastTimeRefershed" not-null="true" />
<property column="start_date" type="DateTime" name="StartDate" not-null="true" />
<property column="end_date" type="DateTime" name="EndDate" />
<property column="xml_url" type="String" name="XmlUrl" not-null="true" length="1000" />
<many-to-one name="AppRssCatalogCategoryId" column="app_rss_catalog_category_id" class="Accordia.DataLayer.Configuration.AppRssCatalogCategory,DataLayer" />

</class>
</hibernate-mapping>
[/b]

Code between sessionFactory.openSession() and session.close():
ISession sess = SessionManager.getSession();
if(!sess.IsConnected)
sess.Reconnect();

System.Net.WebClient webClient = new WebClient();

string str = ASCIIEncoding.Default.GetString(webClient.DownloadData(@"http://news.com.com/2547-1_3-0-5.xml"));

AppRssCatalog rss = new AppRssCatalog();
rss.RssCatalog = str; //this string
XmlDocument doc = new XmlDocument();
doc.LoadXml(str);
string timeToLive = String.Empty;
foreach(XmlNode node in doc.SelectNodes("/rss/channel/ttl"))
{
timeToLive = node.InnerText;
}
if (timeToLive != String.Empty)
{
rss.RssCatalogTimeToLive = int.Parse(timeToLive);
}
else
{
rss.RssCatalogTimeToLive = 0;
}
rss.CurrnetlyAvaible = true;
rss.XmlUrl = @"http://news.com.com/2547-1_3-0-5.xml";

AppRssCatalogCategory cat = (AppRssCatalogCategory)sess.Get(typeof(AppRssCatalogCategory), 1);
rss.AppRssCatalogCategoryId = cat;

cat.AppRssCatalogList.Add(rss);
sess.Update(cat);
sess.Flush();
sess.Disconnect();


Full stack trace of any exception that occurs:

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


The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 20, 2006 2:40 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Use type="StringClob" for the problem field.


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Sat Jan 21, 2006 4:44 am 
Newbie

Joined: Fri Jan 20, 2006 12:48 pm
Posts: 6
I tried it and it works. Thanks a lot.


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