Salome HOME
The draft of the "Copy from existing study" action is added. The YACS step is introdu...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / dal / dao / kernel / GenericDAO.java
index b4a5b9f6cb0a3e9e2292f2f115dc874770b7cdb8..09ea36e505af76f9da7d9183d3af75d65de47a92 100644 (file)
@@ -14,6 +14,7 @@ import java.util.List;
 import java.util.Properties;
 
 import org.hibernate.LockOptions;
+import org.hibernate.Session;
 import org.hibernate.criterion.Criterion;
 import org.hibernate.criterion.DetachedCriteria;
 import org.hibernate.criterion.Order;
@@ -36,6 +37,7 @@ public interface GenericDAO<T, PK extends Serializable> {
         * @param newInstance
         *            new object as a transient instance
         * @return new primary key for the created persistent object
+        * @see Session#save(Object)
         */
        PK create(T newInstance);
 
@@ -44,6 +46,7 @@ public interface GenericDAO<T, PK extends Serializable> {
         * 
         * @param newInstance
         *            new object as a transient instance
+        * @see Session#saveOrUpdate(Object)
         */
        public void saveOrUpdate(final T newInstance);
 
@@ -53,6 +56,7 @@ public interface GenericDAO<T, PK extends Serializable> {
         * @param id
         *            primary key of an object to read
         * @return an object found by the given key
+        * @see Session#get(Class, Serializable)
         */
        T get(PK id);
 
@@ -69,6 +73,7 @@ public interface GenericDAO<T, PK extends Serializable> {
         * 
         * @param transientObject
         *            transient instance of the object to refresh
+        * @see Session#refresh(Object)
         */
        void refresh(T transientObject);
 
@@ -79,6 +84,7 @@ public interface GenericDAO<T, PK extends Serializable> {
         *            transient instance of the object to load
         * @param id
         *            object primary key
+        * @see Session#load(Object, Serializable)
         */
        public void load(final T transientObject, final PK id);
 
@@ -89,6 +95,7 @@ public interface GenericDAO<T, PK extends Serializable> {
         *            transient instance of the object to lock
         * @param lockOptions
         *            lock options
+        * @see Session#refresh(Object, LockOptions)
         */
        public void refresh(final T transientObject, final LockOptions lockOptions);
 
@@ -97,6 +104,7 @@ public interface GenericDAO<T, PK extends Serializable> {
         * 
         * @param persistentObject
         *            a persistent object to delete from the database
+        * @see Session#delete(Object)
         */
        void delete(T persistentObject);
 
@@ -143,6 +151,18 @@ public interface GenericDAO<T, PK extends Serializable> {
         */
        public List<T> getFilteredList(final DetachedCriteria aDetachedCriteria);
 
+       /**
+        * Retrieve a list of DTO objects using the given criteria.
+        * 
+        * @param <DTO>
+        *            the class of returned DTOs
+        * @param aDetachedCriteria
+        *            search criteria
+        * @return a list of DTO objects filtered according to the given criteria
+        */
+       public <DTO> List<DTO> getFilteredDTOList(
+                       final DetachedCriteria aDetachedCriteria);
+
        /**
         * Retrieve a list of objects which were previously persisted to the database using the given criteria.
         * 
@@ -220,24 +240,46 @@ public interface GenericDAO<T, PK extends Serializable> {
        public List<T> getFilteredList(Properties andParams, Order... anOrder);
 
        /**
-        * Makes detached object persistent.
+        * Make a transient instance persistent. This operation cascades to <BR>
+        * associated instances if the association is mapped with cascade="persist".
         * 
         * @param transientObject
         *            transient instance of the object to be made persistent
+        * @see Session#persist(Object)
         */
        public void persist(T transientObject);
 
        /**
-        * Merge detached object with persistent data.
+        * Copy the state of the given object onto the persistent object with the <BR>
+        * same identifier. If there is no persistent instance currently associated<BR>
+        * with the session, it will be loaded. Return the persistent instance. If <BR>
+        * the given instance is unsaved, save a copy of and return it as a newly <BR>
+        * persistent instance. The given instance does not become associated with <BR>
+        * the session. This operation cascades to associated instances if the <BR>
+        * association is mapped with cascade="merge".
         * 
         * @param transientObject
         *            transient instance of the object to be merged with persistent data
         * @return merged persistent object
+        * @see Session#merge(Object)
         */
        public T merge(T transientObject);
 
+       /**
+        * Remove this instance from the session cache. Changes to the instance will<BR>
+        * not be synchronized with the database. This operation cascades to <BR>
+        * associated instances if the association is mapped with cascade="evict".
+        * 
+        * @param persistentObject
+        *            the object to be removed from session cache
+        * @see Session#evict(Object)
+        */
+       public void evict(final T persistentObject);
+
        /**
         * Synchronize the session data with the database.
+        * 
+        * @see Session#flush()
         */
        public void flush();
 }