Kategorien
Java

„Hibernate – A Developers Notebook“ – migrating to Hibernate 3.0, Chapter 8

Chapter 8 introduces Criteria Queries. Only QueryTest.java is affected. Besides the usual net.sf.hibernate to org.hibernate package import renaming, net.sf.hibernate.expressions in Hibernate 2 is replaced by org.hibernate.criterion.

Moreover, change the line

  1. Example example = Example.create(new Artist(namePattern, null, null));

to

  1. Artist artist = new Artist();
  2. artist.setName(namePattern);
  3. Example example = Example.create(artist);

because Hibernate 3 has generated no argument constructors only.