0

alt text http://img18.imageshack.us/img18/5668/dbdiagram.jpg

Hi i got a problem as shown at top.an Db desgin used with oracle is shown below.I want to devolop CRUD processeses for the entities that will be generated over this db diagram.I have to use nhiberante and hql queries.In the diagram relations are succeed over relatinal tables(unit-property relation is succeed over unitporperty table e.g) So how can be done the nhibarene entities and CRUD operations over this diagram complexity?

1

1 Answer 1

1

There is nothing overly complex about that diagram, so I'm going to assume that you are new to NHibernate. In that case, I recommend reading the Quick Start Guide and any of the tutorials here.

The basic process is to create .NET classes which represent your database tables and create mapping files so that NHibernate knows about them. NHibernate will take care of creating the connection between your classes and the database so that you can run HQL queries to retrieve objects. Modify/Create objects in your code and then persist the changes to the database with ISession.Save(). The thing to remember is that (in general) you are not doing the CRUD operations, NHibernate is.

  • CREATE: new MyObject(); followed by session.Save()
  • UPDATE: MyObject.change(); followed by session.Save()
  • DELETE: session.Delete(MyObject);
Sign up to request clarification or add additional context in comments.

3 Comments

Yeah, that one is the tutorials list but should probably be high up in that list instead of at the bottom. It's a good resource.
Correction UPDATE: MyObject.change(); followed by session.Update() or session.SaveOrUpdate()
Actually, it doesn't matter. Internally NHibernate converts all Save(), Update() and SaveOrUpdate() calls to firing the OnSaveOrUpdate event on a ISaveOrUpdateEventListener. These functions merely tell NHibernate to persist the object, it handles the rest. IOW, it's personal preference. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.