Tag Archives: nhibernate

How do I store long strings with Firebird, NHibernate and NHibernate.Mapping.Attributes?

Yes, I know, it’s the hot question of the moment which everyone is asking.

Anyway, I figured that someone else might want to know this, since Firebird is a supported database for NHibernate, and the embedded version is very handy.

This is what the declaration for a member called “Detail” should look like (I think you can omit the “Name” attribute if you want):

[Property(0, Type="StringClob")]
[Column(1, Name="Detail", SqlType = "BLOB SUB_TYPE 1")]
public virtual string Detail { get; set; }

So the SqlType bit is Firebird-specific, and I don’t think it was very obviously documented anywhere in the Firebird docs. It feels a bit nasty to write code like this because it means I’m locked in to one database backend FOREVER.

For a fun bonus rant, the NHibernate page seems to be down at the moment. You can say what you want about Java, but the open-source tools and community are so much richer for Java than they are for C#. In fact, I’d say that C# is at around the Java 1.2 level on this basis.

Posted in Uncategorized | Tagged , | Leave a comment