37. # configure hibernate to use the HSQL in-memory database
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:mem
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.pool_size=1
hibernate.dialect=org.hibernate.dialect.HSQLDialect
# creates tables for us automatically
hibernate.hbm2ddl.auto=create
# let Warp Persist apply the open-session-in-view pattern
hibernate.current_session_context_class=managed
# don’t use 2nd level caching
hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider
38. public class ProductManager {
@Inject Provider<Session> session;
@Transactional
public void create(Product p) {
session.get().save(p);
}
}