Chorn Sokun's Weblog

Conquer inner fear, push it to the limit!

Archive for April 2008

Many to many lazzziii

leave a comment »

I scratched my head for a few hours reading between the line of the following code

DetachedCriteria filter = DetachedCriteria.For(typeof(Project))
  .Add(Expression.Eq("ID", pid))

DetachedCriteria q = DetachedCriteria.For(typeof(List_Output), "op")

ISession s = holder.CreateSession(typeof(List_Output));
IList result;

  result = q.GetExecutableCriteria(s).List();

Wonder why It generate so many sql call to the server? the domain objects in discussion are Project which belong to a Type and base on selected Type a project can choices a bunch of Outputs.
So Project is belong to a Type [One-to-Many], and Type has many Outputs where Output belong to Many Types [Many-to-Many].

After a while I found the issue and got it fixed “it is the Lazzzzzzzziiiiiiiiiiiiiiiines” configuration :))
I forgot to tell Type to load Outputs in a Lazy mode and vise versa, once configured I got only one YEAH ! I mean ONE (a single) sql call to the server instead of 2 + N (where N is number of relevant Outputs in a Type)

Thanks to DetachedCriteria & the Laziness until next time don’t forget the magic word is “Lazy = true”

Written by Chorn Sokun

April 23, 2008 at 3:22 pm

Woh Woh storedprocedure no more …

leave a comment »

Read the title and want to know how to do that? come with me hacking the Castle code base or to be accurate hack NHibernate code base, what you need to bring along? not much but a SubVersion, NAnt, MbUnit and NUnit that sound enough ;)

Enjoy plug & play your database and let the Jedi rise
Happy Friday everyone !

Written by Chorn Sokun

April 18, 2008 at 3:48 pm

Encoded message

leave a comment »

Rob Conery the man behind “SubSonic” a blogger like to post his though in a hex; wonder what on his mind? try this online hex converter

Written by Chorn Sokun

April 6, 2008 at 10:32 am

Posted in Geek

Ubuntu 8.04 Hardy Heron – that for my mom

leave a comment »

If you follow my previous post you might know what I’ve been doing so far, well i was messing around with Ubuntu 8.04 and if you ask me how was that? I would say “Yeah, It is an OS for my mom”. How about you buddi? you asked. See the problem is Ubuntu 8.04 was developed for my mom it wasn’t me ! :( that kind of sad isn’t it?

Now let me express what make me feel this way, I guess you know who I am right? Oh ! com’on I knew you did hahaha I write VB, PHP, Java & C# tool I am expected to see in Hardy Heron

  • Eclipse 3.3 (sorry we got 3.2 )
  • Mono 1.9 (hm hmm, wait and see u might have it next release cycle)
  • MonoDevelop 1.0 (oh, isn’t beta 3 work great for ya ?!)

the Ubuntu guy love to play with giant snake therefore all they care about is Python.

After all I might have to do I miss catch for 8.04 cuz my mom don’t use any computer :(

Written by Chorn Sokun

April 3, 2008 at 12:33 am

Posted in Development, OSS, Tools, Ubuntu