Archive for April, 2011

Hibrn8 for the Rest II

So I found a very user friendly site Hibernate Made Easy which shows very simple examples of how to get the most out of Hibernate. Not having spent a bunch of time using ORM hibernate seems to make your service layer a lot less cluttered.

Some main points that need to be considered when creating your POJOs and getting hibernate to work properly with your classes:

  • Keep the names of your class properties simple! (private String customerId & get/setCustomerId)
  • Make sure you use the full package path for your objects (class=”domain.Customer”)
  • Your id needs to be the primary key of the table in your database.
  • Make sure your property types are equal to what you specify in the hibernate.cfg.xml file
  • Keep in mind that your describing your class not the fields in your database.

One time consuming search was to figure out how to return a single object from the database using variable injection..and Cameron gives examples here

I hope this helps someone who was searching like I was!

posted by Grant in Everyday and have No Comments

Hibernate For the Rest of Us

I was learning Hibernate ORM for java on Netbeans this weekend…there is a bunch of documentation but I find it easier to learn by example. I will lay it out for all this week! Stay tuned!

posted by Grant in Technology and have No Comments