1.0          Other languages
 
 

4.4 Change to another O/R mapping implementation

 
 

If you don't like the O/R mapping given by VelocityWeb, you can switch to other O/R mapping, such as OJB, Hibernate. You need to write your own base DAO class instead of JdbcDao. For example:

public abstract HibernateDAO extends BaseDao {
    private Session session;

    public HibernateDAO(AppContext ctx) {
        Connection con = ctx.getConnection();
        this.session = sessionFactory.openSession(con);
    }
    
    public void save(HibernateBean bean){
        session.save(bean);
    }
    ...
}

Then we can still use the TRANSACTION-PER-REQUEST in VelocityWeb. That may make it easy for correct transaction management.