Chorn Sokun's Weblog

Conquer inner fear, push it to the limit!

NHibernate + Mono + MySQL Fly by

with 7 comments

I thought about it and I want to see it works for me and there it goes ;)

  • Ubuntu Karmic
  • Mono 2.4.3
  • NHibernate (trunk)
  • MySql connector-net (trunk)

rebuild the stack for new home ;)

Sweet :) next rediscover Castle stack on Mono that should be fun let see how much I stress MonoDevelop 2.2

Written by Chorn Sokun

November 5, 2009 at 5:11 pm

Posted in Brainstorm, OSS, Ubuntu

Tagged with , ,

7 Responses

Subscribe to comments with RSS.

  1. Hi Chorn,

    I tried for almost 4 hours but could not get NHibernate to work on Mono. I downloaded NHibernate 2.1.2GA src and bin. But none of them works. In the MonoDevelop IDE when I add nhibernate.dll and double click on it, I found that three references that nhibernate refers to are not be able to be found.

    Can you give me more directions? Can I have your nhibernate.dll to try on my machine?

    Many thanks.


    December 15, 2009 at 11:24 pm

    • I think I figured out the way. Thanks.


      December 16, 2009 at 5:00 am

      • Cool ! I am just about to send you my MD solution file :)
        Would you mind sharing your way to fix the problem?

        Chorn Sokun

        December 16, 2009 at 8:37 am

  2. Sorry that I was a bit late to reply your question. The problem I had is a little bit strange. Initially when I was configuring hibernate.cfg.xml, I got this error message.
    “Unhandled Exception: NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException: The ProxyFactoryFactory was not configured.
    Initialize ‘proxyfactory.factory_class’ property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
    NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
    NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle
    at NHibernate.Bytecode.AbstractBytecodeProvider.get_ProxyFactoryFactory () [0x00000] in :0
    at NHibernate.Cfg.Configuration.ValidateEntities () [0x00000] in :0
    at NHibernate.Cfg.Configuration.Validate () [0x00000] in :0
    at NHibernate.Cfg.Configuration.BuildSessionFactory () [0x00000] in :0
    at NH1.MainClass.Main (System.String[] args) [0x00010] in /Users/puli/Documents/workspace/Csharp/NH1/NH1/Main.cs:14 ”

    Then I followed this error message and tried to add NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle But no matter how I tried it, it kept showing this message. That’s when I posted the previous comment on your blog.

    Later when I tried again, after I simply added this line “Configuration cfg = new Configuration().Configure(“hibernate.cfg.xml”);” to the Main method. The error message went away.

    So I was able to get NHibernate to work with Mono. And I am happy.


    December 27, 2009 at 5:04 am

  3. Could you provide a source code with NHibernate dll’s. I’m struggling with NHibernate 3, I always got known error when I try to create mapppings (

    How did you pass this?
    I always got this known XML Serialization error
    System.InvalidOperationException: To be XML serializable, types which inherit from IEnumerable must have an implementation of Add(NHibernate.Cfg.MappingSchema.HbmJoinedSubclass) at all levels of their inheritance hierarchy. System.Collections.Generic.IEnumerable`1[[NHibernate.Cfg.MappingSchema.HbmJoinedSubclass, NHibernate, Version=, Culture=neutral, PublicKeyToken=aa95f207798dfdb4]] does not implement Add(NHibernate.Cfg.MappingSchema.HbmJoinedSubclass)

    Kornelije Sajler

    Kornelije Sajler

    January 22, 2010 at 6:45 pm

  4. I can’t get passed the mysql reflection…

    it would be really, really, really helpful to see the sample code, especially you Post.hbm.xml ….

    Many many thanks


    February 13, 2010 at 10:00 pm

  5. Where can i download the NH1 solution ?


    April 27, 2010 at 6:47 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: