-
Notifications
You must be signed in to change notification settings - Fork 2
Object Manager DAO
khubla edited this page Mar 19, 2012
·
1 revision
The Object Manager DAO allows easy use of OM, via a generic DAO. In order to use this, you must have a configuration file for OM defined, called objectmanager.xml. Most users can use the default version:
To define your POJO, just use the OM @Entity and @Property annotations.
Then, define a DAO for your POJO, like this:
public class TestEntityDAO extends GenericDAOImpl<TestEntity> implements GenericDAO<TestEntity> { /** * ctor */ public TestEntityDAO() { super(TestEntity.class); } }
To fetch your POJO from the CMS, simply use the "get" API on the generic DAO. Note that the GenericDAO knows how to get a JCR session and an ObjectManager session, via objectmanager.xml
final TestEntity testEntity = testEntityDAO.get(new Path("foo/bar"));