AutoDAO is DAO made on steroids. Quick, simple and easy to use.

Create persistent entity

@Entity
public class Book {
  @Id
  @GeneratedValue
  private Long id;
  @Unique
  private String title;

  public String getTitle() { return title; }
  public void setTitle(String title) { this.title = title;  }
}

Create DAO interface

package myApp;

@AutoDAO
public interface BookDao {
  // this finder method uses index-based parameters and returns a single object
  @Finder(query="select b from Book b where title = ?")
  Book getByTitle(String title);

  // and this one uses named parameters and returns object list
  @Finder(query="select b from Book b where title like :title")
  List<Book> findWithTitleLike(@Named("title") String title);
}

Configure persistence provider

Hibernate: session factory setup

JPA: JPA entity manager setup

Enable DAO autodiscovery in in Spring configuration file

Hibernate:

<dao:hibernateScan
      base-package="myApp"
      xmlns:dao="http://autodao.sourceforge.net/schemas/autodao-0.12"
      xsi:schemaLocation="http://autodao.sourceforge.net/schemas/autodao-0.12
                          http://autodao.sourceforge.net/schemas/autodao-0.12.xsd" />

JPA:

<dao:jpaScan
      base-package="myApp"
      xmlns:dao="http://autodao.sourceforge.net/schemas/autodao-0.12"
      xsi:schemaLocation="http://autodao.sourceforge.net/schemas/autodao-0.12
                          http://autodao.sourceforge.net/schemas/autodao-0.12.xsd" />

Now use can use your DAO

@Resource BookDao bookDao; // Inject DAO with Spring
public void writeBooks() {
    Book fromDb = bookDao.findByTitle("Wicket in Action");
    if(fromDb != null) {
      System.out.println(fromDb.getTitle()); // outputs found book title
    } else {
      System.out.println("There is no 'Wicket in Action' book avaliable.")
    }

    List<Books> allBooks = bookDao.findWithTitleLike("%AutoDAO%");
    for (Book b : allBooks) {
      System.out.println(b.getTitle()); // output all books' titles about AutoDAO usage
    }
}

That's it. No DAO implementation in your code at all! Now you can use HQL queries without a line of code written to implement their usage.

Further steps

You can read User Guide for more in-depth description of what AutoDAO can do for you or directly proceed to download section.