Сообщения

MS Lesson ?: Exception Handling

package com.azercell.akbintegrationservice.error.enums; import lombok. Getter ; import lombok. RequiredArgsConstructor ; import org.springframework.http.HttpStatus; import java.text.MessageFormat; @Getter @RequiredArgsConstructor public enum ErrorCode { VALIDATION_FAILED ( "VALIDATION_FAILED" , "Validation failed" , "One or more fields failed validation." , HttpStatus. BAD_REQUEST ), METHOD_VALIDATION_FAILED ( "METHOD_VALIDATION_FAILED" , "Method validation failed" , "One or more method parameters failed validation." , HttpStatus. BAD_REQUEST ), CONSTRAINT_VIOLATION ( "CONSTRAINT_VIOLATION" , "Constraint violation" , "One or more constraints were violated." , HttpStatus. BAD_REQUEST ), REQUEST_BODY_NOT_READABLE ( ...

MS Lesson16: Cache. L1 cache, Redis

1. L1 chace first level cache-dir, Hibernate-in en esas daxili cache-dir.  Her Session/EntityManager ucun ayrica olur. Default olaraq hemish aktivdir. Session muddetinde yuklenen entity-leri yadda saxlayir. Session bitende  (transaction bitib context baglananda) bu cache-da bitir.  Arxa fonda Map<EntityKey, Object> sheklinde saxlanilir. Bu map proxy uzerinden yaranmir. Bu map birbasha Session-un daxili strukturudur. *** Eyni EntityManager/Session daxilinde icra olunan query entity instance qaytarirsa, Hibernate onu persistance context-e daxil edir.  mes menim bele bir kodum varsa: @Override @Transactional public void foo () { Account parvin = accountRepository .findAccountByName( "Parvin" ).get(); Account account = accountRepository .findAccountByName( "Parvin" ).get(); System. out .println(parvin == account); } Burada addim addim ne bash verir: 1. Hibernate ilk select-i atir, ve oyekti getirir. Sonra map-a qoyur key = id value = entity ozu.  2...