ORM

Working with Hibernate and DB2 9, if you have a byte[] member in your entity which is supposed to be mapped to a BLOB column, you'll probably get:

ERROR [org.hibernate.util.JDBCExceptionReporter] - <DB2 SQL Error: SQLCODE=-301, SQLSTATE=07006, SQLERRMC=2, DRIVER=3.61.75>
ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - <Could not synchronize database state with session>
org.hibernate.exception.SQLGrammarException: could not insert...

Which in general means wrong data type!

After throwing lots of hooks into the sea of Google & IBM, I came up with this one - thanks to Steve for his excellent fish

www.badlildog.com/words/

avim 08/02/2011 - 11:47

http://seldo.com/weblog/2011/06/15/orm_is_an_antipattern

 

The author lists why using an ORM is bad and provides some alternatives. 

 

I think the same for all points that he makes. The rule of thumb for me: don't abstract an abstraction. SQL is an abstraction for handling relational data. Coercing it to an OO abstraction means we loose at both ends. There are other areas such as this. E.g., coercing Javascript's prototype based model to OO by various frameworks.

ittayd 15/06/2011 - 22:23
orm, ORM

NHibernate is popular in Open-source community, fully featured, mature ORM but the way to config mappings in XML files (.hbm.xml files) is not comfort.

I would prefer to write mappings in strongly typed C# code and enjoy from easy refactoring, improved readability and more concise code.

 

Fluent NHibernate resolves this issue and provides alternative to NHibernate's standard XML mapping files - fluent, XML-less, compile safe.

 

Samples of mappings:

michael 03/06/2010 - 14:12
Syndicate content