Esempio n. 1
0
        public virtual void onEntityLoaded(DbEntity entity)
        {
            // we get a callback when the persistence session loads an object from the database
            DbEntity cachedPersistentObject = dbEntityCache.get(entity.GetType(), entity.Id);

            if (cachedPersistentObject == null)
            {
                // only put into the cache if not already present
                dbEntityCache.putPersistent(entity);

                // invoke postLoad() lifecycle method
                if (entity is DbEntityLifecycleAware)
                {
                    DbEntityLifecycleAware lifecycleAware = (DbEntityLifecycleAware)entity;
                    lifecycleAware.postLoad();
                }
            }
        }