c# - Acessing Data in NHibernate -
i've read on documentation , tutorials on nhibernate don't understand how manipulate data in database. setup nhibernate 2.1 , oracle database.
when want manipulate or read data database use get/load load entity data want or have use criteria query database first?
have seen chapter 9 of nhibernate reference, manipulating data? has short pointers on different aspects. get() or querying, if know identifier use get() or load(), otherwise use of querying apis.
here example using load(). inside open session , transaction this:
domesticcat cat = (domesticcat) sess.load<cat>( 69l ); cat.name = "pk"; sess.flush(); // changes cat automatically detected , persisted // flush not required if flushmode commit or auto (and // transactions used, should). note nhibernate 2.1 old. consider using newer version, @ least aware things mentioned in current documentation isn't available in such old version.
Comments
Post a Comment