This page covers the following JIRA issues: UPT-77
Goals
Implement existing DAO interfaces using Hibernate and Spring. Current implementations are written using SpringJDBC approach. The hope is that using Hibernate will increase flexibility and reduce the amount of code.
Implementation requirements
Interfaces need to be implemented
-IPortletDefinitionDao
-IPortletApplicationDefinitionDao
-IPortletEntityDao
-IPortletApplicationEntityDao
-IPortletWindowDao
-IPortletPreferencesDao
These are core domain object DAO interfaces. There are a few other DAOs in the framework, which we can add later on.
SpringJDBC implementation
Current (SpringJDBC) implementations of these interfaces are located in org.jasig.portal.portlet.dao.springjdbc package. The initial snapshot of the database is described by tables.xml and data.xml files, and is loaded upon uPortal deployment using our custom DbLoader tool. We need to maintain ability to seed database with some information upon uPortal deployment.
Spring integration
Current DAO configuration is described in persistence_beans.xml. Please refer to the Hibernate section of the Spring documentation for configuration advice.
Unit testing and procedure
Unit thests for the existing SpringJDBC implementation are located in the tests folder, under the same package as the implementations. Hibernate implementations should have unit tests, with at least the same level of functional coverage. The tests currently rely on BaseDbTestCase, which initializes the database tables with data required for the tests. I imagine Hibernate tests will have to be derived from another such base class.
For development purposes, it may be possible to start replacing some of the DAO implementations, while leaving others as they are. Be careful with sequence ID fields.