Salome HOME
Simulation context type selection is fixed in study search. Lucene is no more used...
authorrkv <rkv@opencascade.com>
Thu, 28 Feb 2013 07:11:05 +0000 (07:11 +0000)
committerrkv <rkv@opencascade.com>
Thu, 28 Feb 2013 07:11:05 +0000 (07:11 +0000)
Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractGenericDAOImpl.java
Workspace/Siman-Common/src/org/splat/dal/dao/kernel/GenericDAO.java

index 0aef576cccee1075c9be9e2451d1de59788ea6d2..64996b4234c6b3d042390bb9c30ec18b079bc615 100644 (file)
@@ -14,7 +14,9 @@ import java.util.List;
 import java.util.Properties;
 
 import org.hibernate.Criteria;
+import org.hibernate.LockOptions;
 import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.DetachedCriteria;
 import org.hibernate.criterion.Order;
 import org.hibernate.criterion.Restrictions;
 import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
@@ -128,6 +130,18 @@ public abstract class AbstractGenericDAOImpl<T, PK extends Serializable>
                return aCriteria.list();
        }
 
+       /**
+        * Retrieve a list of objects which were previously persisted to the database using the given criteria.
+        * 
+        * @param aDetachedCriteria
+        *            search criteria
+        * @return a list of objects filtered according to the given criteria
+        */
+       @SuppressWarnings(UNCHECKED)
+       public List<T> getFilteredList(final DetachedCriteria aDetachedCriteria) {
+               return aDetachedCriteria.getExecutableCriteria(getSession()).list();
+       }
+
        /**
         * Retrieve a list of objects which were previously persisted to the database using the given criteria.
         * 
@@ -241,6 +255,40 @@ public abstract class AbstractGenericDAOImpl<T, PK extends Serializable>
                getSession().update(transientObject);
        }
 
+       /**
+        * Refresh a persistent object.
+        * 
+        * @param transientObject
+        *            transient instance of the object to refresh
+        */
+       public void refresh(final T transientObject) {
+               getSession().refresh(transientObject);
+       }
+
+       /**
+        * Load a persistent object.
+        * 
+        * @param transientObject
+        *            transient instance of the object to load
+        * @param id
+        *            object primary key
+        */
+       public void load(final T transientObject, final PK id) {
+               getSession().load(transientObject, id);
+       }
+
+       /**
+        * Lock a persistent object.
+        * 
+        * @param transientObject
+        *            transient instance of the object to lock
+        * @param lockOptions
+        *            lock options
+        */
+       public void refresh(final T transientObject, final LockOptions lockOptions) {
+               getSession().refresh(transientObject, lockOptions);
+       }
+
        /**
         * Remove an object from persistent storage in the database.
         * 
index fa8ee40d730d412a7d15c5525747ed11a244377e..b4a5b9f6cb0a3e9e2292f2f115dc874770b7cdb8 100644 (file)
@@ -13,7 +13,9 @@ import java.io.Serializable;
 import java.util.List;
 import java.util.Properties;
 
+import org.hibernate.LockOptions;
 import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.DetachedCriteria;
 import org.hibernate.criterion.Order;
 
 /**
@@ -62,6 +64,34 @@ public interface GenericDAO<T, PK extends Serializable> {
         */
        void update(T transientObject);
 
+       /**
+        * Refresh a persistent object.
+        * 
+        * @param transientObject
+        *            transient instance of the object to refresh
+        */
+       void refresh(T transientObject);
+
+       /**
+        * Load a persistent object.
+        * 
+        * @param transientObject
+        *            transient instance of the object to load
+        * @param id
+        *            object primary key
+        */
+       public void load(final T transientObject, final PK id);
+
+       /**
+        * Lock a persistent object.
+        * 
+        * @param transientObject
+        *            transient instance of the object to lock
+        * @param lockOptions
+        *            lock options
+        */
+       public void refresh(final T transientObject, final LockOptions lockOptions);
+
        /**
         * Remove an object from persistent storage in the database.
         * 
@@ -104,6 +134,15 @@ public interface GenericDAO<T, PK extends Serializable> {
         */
        public List<T> getAll(Order... anOrder);
 
+       /**
+        * Retrieve a list of objects which were previously persisted to the database using the given criteria.
+        * 
+        * @param aDetachedCriteria
+        *            search criteria
+        * @return a list of objects filtered according to the given criteria
+        */
+       public List<T> getFilteredList(final DetachedCriteria aDetachedCriteria);
+
        /**
         * Retrieve a list of objects which were previously persisted to the database using the given criteria.
         *