Understanding One to Many relationships in NHibernate

Tuesday, July 12, 2011

One to many relationships in a relational model is probably the most common kind of relationship used in a relational database. Typically, the table in the “many” side of the relationship contains a special column in which each row contains the Id of the corresponding row in the table at the ‘one’ side. Even though this is very straight-forward in the relational database model, there are many nuances as how to map it to the object-oriented model. These nuances confuses many developers, especially those new to NHibernate. In this post I’ll try to explain each of these...

A glimpse into “NHibernate – data access made easy!” workshop at Expert Days

Wednesday, June 29, 2011

Expert Days is just around the corner (July 10, in case you forgot…), and I’m super excited toward my workshop “NHibernate – data access made easy!”. In case you haven’t heard of NHibernate yet, this is a the most successful, powerful and yet pretty easy-to-use open-source ORM technology for .Net. ORM stands for Object/Relational Mapping, and in short it means that it bridges the gap between your object-oriented business-logic layer and the relational database. It has many benefits, including: 1. It saves you a lot of time and money, because most of the DAL is implemented for you! (and it’s...
no comments

Register to "NHibernate – data access made easy!" and get 20% off!

Sunday, June 5, 2011

1: using E4D.ExpertDays; 2: 3: public void Get20PercentsDiscountForNHibernateWorkshop()    4: { 5:     ReadMyPreviousBlogPost(); 6:     if (you.WantToRegister("NHibernate - data access made easy!") 7:        && you.WantADiscountOf(20).Percents)    8:     { 9:         OnRegistration += () => 10:         { 11:             Specify("Arnon sent me :-)");...
no comments

Come meet me at Expert Days!

Friday, June 3, 2011

:בואו לפגוש אותי ב עורכת את הכנס השנתי למקצועני טכנולוגיות מייקרוסופט. השנה הכנס E4D גם השנה יתקיים בפארק אזורים, פ”ת בין התאריכים 10-14 ליולי ויכלול למעלה מ-35 סנדאות של יום שלם שיועברו ע”י 21 מרצים המומחים בתחומם! בכנס תוכלו למצוא סדנאות במגוון מסלולים המיועדים למפתחים, ראשי צוותים, ארכיטקטים ובודקי תוכנה. כך לדוגמא נכללים בכנס סדנאות בנושאים הללו: ... ועוד.NET , Dynamic CRM, AZURE, WCF, Silverlight, Windows Phone 7 אני אעביר השנה את הסדנא: NHibernate – Data access made easy! .net-שהוסבה ל Open-Source זוהי טכנולוגיית ,NHibernate למי מכם שעוד לא שמע על בצורה Database-לבין ה Business Logic-ומאפשרת לגשר על הפער שבין ה Java-מעולם הdata-access-בשכבת ה “plumbing...
no comments

hibernate-mapping.xsd with comments is ready!

Sunday, February 27, 2011

Hi! As I promised in an earlier post, I’m publishing the hibernate-mapping.xsd to which I’ve added the documentation, and you’re the first to know! So now you can enjoy IntelliSense tooltips while your editing your *.hbm.xml files, like this: I’m trying to contact NHibernate owners in order to submit this to the official NHibernate source files, but I’m still waiting for their response. In the mean time, you can be the first to enjoy it by downloading it from the link below.

"Introduction to NHibernate" presentation and demo

Sunday, January 30, 2011

Last week I presented a lecture about NHibernate to the .Net division of E4D Solutions. Now all of you can download the presentation and the demo sources (attached to this post). The zip file contains: NHibernteDemo.pptx - this is the PowerPoint presentation. NHibernateTest.mdf - this is the database used for the demo. Attach this database to your local SQL Server. 6 folders containing the demo sources split into stages. The solutions are for VS2010 and contain 2 projects: Client and BusinesLogic. Note that the Client are the same for all stages and only the BusinessLogic projects are changed. Notes:  If you don't have NHibernate binaries you...
no comments

Tip of the day for NHibernate #2: show_sql and format_sql

Wednesday, January 19, 2011

As always with tips, either you already know this or it would be invaluable. This time I'm talking about 2 configuration properties: "show_sql" and "format_sql". To switch on these options, add the corresponding lines to your hibernate.cfg.xml file as in the following example: <?xml version="1.0" encoding="utf-8" ?> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">   <session-factory>     <property name="connection.connection_string">Data Source=.;Initial Catalog=NHibernateDemo;Integrated Security=True</property>     <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>     <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>     <property name="show_sql">True</property>     <property name="format_sql">True</property>     <mapping assembly="BusinessLogic"/>   </session-factory> </hibernate-configuration> What is does? The “show_sql” property tells NHibernate to output all the SQL statements it executes onto the console. This way you can see exactly what...

Tip of the day on NHibernate: IntelliSense for the hbm files

Tuesday, January 11, 2011

If you're using NHibernate and writing your NHibernate mapping files (*.hbm.xml) by hand, (as opposed to using Fluent NHibernate for example), then you'll probably be interested in the following tip (unless you already done that :-) ) You can have IntelliSense validation and auto-completion in the XML editor for NHibernate xml files (both the *.hbm.xml and hibernate.cfg.xml) by following the following steps: 1. Inside VS, select XML->Schemas. 2. Click "Add..." 3. Browse to the "Required_bins" folder inside of your NHibernate folder (e.g. "C:\Nhibernate3.0\Required_bins") 4. Select both "nhibernate-configuration.xsd" and "nhibernate-mapping.xsd" file and click "Open". The 2 schemas will be added to the list: 5. Click OK...
no comments