Translations of this page:

Using the library

Main class you should use is ILMLFacade. Actually this is an interface and it provides library functionality.
The implementation class is LMLFacadeImpl. To get an instance of this one you should use LMLFacadeFactory.


Ejemplo: (Read customer info using his identifier)

Customer result = LMLFacadeFactory.createLMLFacade().read(Customer.class, customerId, 2);


Main inteface methods explanation


Main interface content:

public interface ILMLFacade {
 
    /**
     * This method is used to save an entity in the database.
     * 
     * @param entity
     * @return saved entity
     * @throws InternalErrorException (DuplicateInstanceException, ReflectionException)
     */
    public <T> T save(T entity) throws InternalErrorException;
 
     /**
     * This method reads an entity from the database. detailLevel param determines the 
     * amount of related info that must be read.
     * 
     * @param entityType
     * @param entityId
     * @param detailLevel
     * @return entity read
     * @throws InternalErrorException (DataNotFoundException, ReflectionException)
     */
    public <T> T read(Class<T> entityType, Object entityId, Integer detailLevel) throws InternalErrorException;
 
    /**
     * This method updates the information from an entity in the database.
     * 
     * @param entity
     * @return udpated entity
     * @throws InternalErrorException (DataNotFoundException, ReflectionException)
     */
    public <T> T update(T entity) throws InternalErrorException;
 
     /**
     * This method removes an entity from the database.
     * 
     * @param entity to be removed (it only needs to be populated with its identifier)
     * @return removed entity
     * @throws InternalErrorException (DataNotFoundException, ReflectionException)
     */
    public <T> T remove(T entity) throws InternalErrorException;
 
    /**
     * 
     * @param query
     * @param entityType
     * @param detailLevel
     * @param params
     * @return collection of entities
     * @throws InternalErrorException (DataNotFoundException, ReflectionException)
     */
    public <T> List<T> finder(String query, Class<T> entityType, Integer detailLevel, Object ... params) throws InternalErrorException;
 
}


 
using_library.txt · Last modified: 2009/01/08 23:00 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki