Class DbSqlSession

  • All Implemented Interfaces:
    Session

    public class DbSqlSession
    extends Object
    implements Session
    Author:
    Tom Baeyens, Joram Barrez
    • Method Detail

      • directInsert

        public int directInsert​(String statement,
                                Object parameters)
      • update

        public void update​(Entity entity)
      • directUpdate

        public int directUpdate​(String statement,
                                Object parameters)
      • delete

        public void delete​(String statement,
                           Object parameter,
                           Class<? extends Entity> entityClass)
        Executes a BulkDeleteOperation, with the sql in the statement parameter. The passed class determines when this operation will be executed: it will be executed depending on the place of the class in the EntityDependencyOrder.
      • delete

        public void delete​(Entity entity)
      • selectList

        public List selectList​(String statement)
      • selectList

        public List selectList​(String statement,
                               Object parameter,
                               int firstResult,
                               int maxResults)
      • selectListNoCacheLoadAndStore

        public List selectListNoCacheLoadAndStore​(String statement,
                                                  Object parameter)
      • selectListWithRawParameterNoCacheLoadAndStore

        public List selectListWithRawParameterNoCacheLoadAndStore​(String statement,
                                                                  Object parameter)
      • selectListWithRawParameter

        public List selectListWithRawParameter​(String statement,
                                               Object parameter)
      • queryWithRawParameter

        public List queryWithRawParameter​(String statement,
                                          CacheAwareQuery parameter,
                                          Class entityClass,
                                          boolean cacheLoadAndStore)
      • queryWithRawParameterNoCacheLoadAndStore

        public List queryWithRawParameterNoCacheLoadAndStore​(String statement,
                                                             CacheAwareQuery parameter,
                                                             Class entityClass)
      • selectListWithRawParameter

        public List selectListWithRawParameter​(String statement,
                                               Object parameter,
                                               boolean useCache)
      • selectById

        public <T extends Entity> T selectById​(Class<T> entityClass,
                                               String id)
      • selectById

        public <T extends Entity> T selectById​(Class<T> entityClass,
                                               String id,
                                               boolean useCache)
      • cacheLoadOrStore

        protected List cacheLoadOrStore​(List<Object> loadedObjects,
                                        Object parameter)
      • cacheLoadOrStore

        protected Entity cacheLoadOrStore​(Entity entity,
                                          Object parameter)
        Returns the object in the cache. If this object was loaded before, then the original object is returned (the cached version is more recent). If this is the first time this object is loaded, then the loadedObject is added to the cache.
      • flush

        public void flush()
        Specified by:
        flush in interface Session
      • removeUnnecessaryOperations

        protected void removeUnnecessaryOperations()
        Clears all deleted and inserted objects from the cache, and removes inserts and deletes that cancel each other. Also removes deletes with duplicate ids.
      • determineUpdatedObjects

        public void determineUpdatedObjects()
      • debugFlush

        protected void debugFlush()
      • isEntityInserted

        public boolean isEntityInserted​(Entity entity)
      • isEntityInserted

        public boolean isEntityInserted​(Class<?> entityClass,
                                        String entityId)
      • isEntityToBeDeleted

        public boolean isEntityToBeDeleted​(Entity entity)
      • flushInserts

        protected void flushInserts()
      • flushInsertEntities

        protected void flushInsertEntities​(Class<? extends Entity> entityClass,
                                           Collection<Entity> entitiesToInsert)
      • flushRegularInsert

        protected void flushRegularInsert​(Entity entity,
                                          Class<? extends Entity> clazz)
      • incrementRevision

        protected void incrementRevision​(Entity insertedObject)
      • flushUpdates

        protected void flushUpdates()
      • flushDeletes

        protected void flushDeletes()
      • flushDeleteEntities

        protected void flushDeleteEntities​(Class<? extends Entity> entityClass,
                                           Collection<Entity> entitiesToDelete)
      • close

        public void close()
        Specified by:
        close in interface Session
      • commit

        public void commit()
      • rollback

        public void rollback()
      • getCustomMapper

        public <T> T getCustomMapper​(Class<T> type)
      • getSqlSession

        public org.apache.ibatis.session.SqlSession getSqlSession()
      • getConnectionMetadataDefaultCatalog

        public String getConnectionMetadataDefaultCatalog()
      • setConnectionMetadataDefaultCatalog

        public void setConnectionMetadataDefaultCatalog​(String connectionMetadataDefaultCatalog)
      • getConnectionMetadataDefaultSchema

        public String getConnectionMetadataDefaultSchema()
      • setConnectionMetadataDefaultSchema

        public void setConnectionMetadataDefaultSchema​(String connectionMetadataDefaultSchema)