Spring

Core

 * http://www.springbyexample.org/examples/
 * http://static.springsource.org/spring/docs/2.5.x/reference/orm.html
 * http://www.ibm.com/developerworks/web/library/wa-spring2/

With Hibernate
public class HibernateAccountRepository implements AccountRepository {
 * http://www.springbyexample.org/examples/simple-hibernate-xml-config.html
 * http://forum.springsource.org/showthread.php?t=55520"As of Hibernate 3.0.1, transactional Hibernate access code can also be coded in plain Hibernate style. Hence, for newly started projects, consider adopting the standard Hibernate3 style of coding data access objects instead, based on SessionFactory.getCurrentSession."
 * http://blog.springsource.com/2007/06/26/so-should-you-still-use-springs-hibernatetemplate-andor-jpatemplate/

private SessionFactory factory;

public HibernateAccountRepository(SessionFactory factory) { this.factory = factory; }

public Account loadAccount(String username) { return (Account)factory.getCurrentSession .createQuery("from Account acc where acc.name = :name") .setParameter("name", "Alef").uniqueResult; } }