Strings are unbounded, however it appears every normal relational database mandates that a column declare its maximum length. This appears to become a rather significant discrepancy and I am curious how typical ORMs handle this.

Utilizing a 'text' column type would theoretically provide you with a lot more string-like storage, but when i comprehend it text posts aren't queryable, or at best not effectively (non-indexed?).

I am considering using something similar to NHibernate possibly, but my ORM needs are easy, therefore if I'm able to just write it myself it could avoid wasting bloat.

Based on my understanding, it normally won't handle it, either you allow the ORM define the schema, then: The ORM will decide the dimensions either past due or based on your config.

Or even the schema isn't deined through the ORM, it just needs to obey the guidelines, should you place too big strings, then you will get errors in the DB.

I'd remain on varcharish types, e.g. varchar2 for oracle or nvarchar for sql server, unless of course you are coping with clobs.

SqlServer for example stores just the actual size the information. For me personally, determining a sizable enough size for strings is enough the user does not recognize the limits.


  • title of the product, person etc: 500
  • Pathways, Web addresses etc: 1000
  • Comments, free text: 2000 or maybe more

NHibernate doesn't anything using the size at runtime. You should utilize some type of validator or allow the database either cut or throw the best.

Quote: "my ORM needs are easyInch. It's difficult to express if NHibernate is overkill or otherwise. Data access is not generally that easy.

As a quick guide of the top my mind, take NHibernate if:

  • You've got a fine-grained or complex domain model. You have to map inheritance.
  • You would like your domain model somewhat independent in the database model.
  • You'll need some lazy loading features
  • You need to be database independent, eg. run it on SqlServer or Oracle

If you feel a category per table is the thing you need, you do not really require a ORM.