Persistence

cancel
Showing results for 
Search instead for 
Did you mean: 

Persistence

resplin
Intermediate
0 0 2,083

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



DevelopingDatabaseCore Repository Services


Persistence Components


Programming to Interfaces


Wherever possible, all interaction with POJOs and services will be against an interface.  This allows the switching of implementations using the configuration of Spring.


Using Hibernate


Below the public services layer, components will operate on POJOs.  All basic DAO operations will be available on these objects directly.  This means that components can attribute and relationship modification, deletions and additions can be performed without having any knowledge of the persistence mechanisms involved.  Transactions will be handled by Spring and Hibernate interaction.

Hibernate Node Model

Not all operations can be performed on POJOs, however.  For example:


  • Operations which are performed on multiple instances of logical data - deleting multiple nodes
  • Construction and deletion of instances

These operations will be present on a DAO service specific to the operations in question.


DAO Service Interfaces


DAOService


void deleteInstance(Object persistentObj)

Description:

Ensures that the given persistent object removed from the data store.  The object provided must be treated as deleted after this operation and will therefore probably be discarded.

Parameters:


  • persistentObj - the instance to remove from the persistence store

Result:





List executeNamedQuery(String queryName, Object[] parameters)

Description:

Execute the given named query

Parameters:


  • queryName - the name of the query
  • parameters - the query parameters.  If null, will be treated as an empty Object[]

Result:


  • Returns a list of persistent instances, the types of which must be known by the caller

NodeDAOService extends DAOService


Node newNode()

Description:

Constructs a new implementation of a Node interface.  The actual implementation may be a HibernateNodeImpl or any other type that the DAO service chooses.

Parameters:



Result:


  • new Node implementation



Any other Node-specific methods as required, such as deleteAllNodes