File tree Expand file tree Collapse file tree 5 files changed +36
-27
lines changed
Expand file tree Collapse file tree 5 files changed +36
-27
lines changed Original file line number Diff line number Diff line change 11# JPA - EXTENSION
22
3- This project look like QueryDsl but main purpuse is query creation with simple DTO (Pojo) objects. So we can simply ingrate with frontend application filters or somethings. Received query converted to Jpa Specification object and this Specification<Entity > executed on JpaSpecificationExecutor<Entity > repository.
4-
5- ## TODO
6-
7- +Namingleri duzenle.
8-
9- - Genel Refactor.
10- +Bug report. eger ayni joinden birden fazla istek atiliyorsa birden fazla kere inner join yapiliyor.
11- -- DynamicQuery.builder() deyince Query DSL gelsin.
12- - Serializable support et. Field convertion'u duzgun yap.
13- - Entity Enumarated'larda hata aliyorduk sanki onu da duzelt.
14- - SearchQuery'nin Select'siz versiyonunu yap.
15- - ApplicationContextUtil kismina baska birsey dusun. => EntityManagerProvider diye Bean yap ve If Condition missing
16- ekle. EntityManager Provide etsin.
17-
18- + POM dosyasindaki proje gereksinimi olan dependecyleri kaldir.
19- + POM da versiyon guncelle ve Spring Boot 2.7.18'de calisir durumda test et.
20-
21- - Spring Boot 3.1.1 de calisir durumda test et.
22- - Jar dosyasi olustur ve maven repository'e at.
23- - Readme dosyasini duzenle.
24-
25- ## NEXT TODOs
26-
27- - Policy ile yetkilendirme altyapisi kur ki db'de isteyen istedigi yere git gel yapmasin.
3+ This project look like QueryDsl but main purpuse is query creation with simple DTO (Pojo) objects. So we can simply
4+ ingrate with frontend application filters or somethings. Received query converted to Jpa Specification object and this
5+ Specification<Entity > executed on JpaSpecificationExecutor<Entity > repository.
286
297``` java
308
Original file line number Diff line number Diff line change 2929 <groupId >org.springframework</groupId >
3030 <artifactId >spring-webmvc</artifactId >
3131 </dependency >
32+ <dependency >
33+ <groupId >org.springframework.boot</groupId >
34+ <artifactId >spring-boot-autoconfigure</artifactId >
35+ </dependency >
3236 <dependency >
3337 <groupId >org.springframework.data</groupId >
3438 <artifactId >spring-data-commons</artifactId >
Original file line number Diff line number Diff line change 1+ package com .beyt .config ;
2+
3+ import com .beyt .provider .IEntityManagerProvider ;
4+ import org .springframework .boot .autoconfigure .condition .ConditionalOnMissingBean ;
5+ import org .springframework .context .annotation .Bean ;
6+ import org .springframework .context .annotation .Configuration ;
7+
8+ import javax .persistence .EntityManager ;
9+
10+ @ Configuration
11+ public class EntityManagerProviderConfig {
12+
13+ @ Bean
14+ @ ConditionalOnMissingBean
15+ public IEntityManagerProvider entityManagerProvider (EntityManager entityManager ) {
16+ return () -> entityManager ;
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ package com .beyt .provider ;
2+
3+ import javax .persistence .EntityManager ;
4+
5+ public interface IEntityManagerProvider {
6+ EntityManager provide ();
7+ }
Original file line number Diff line number Diff line change 11package com .beyt .util ;
22
3+ import com .beyt .provider .IEntityManagerProvider ;
34import org .springframework .beans .BeansException ;
45import org .springframework .context .ApplicationContext ;
56import org .springframework .context .ApplicationContextAware ;
89
910public class ApplicationContextUtil implements ApplicationContextAware {
1011 private static ApplicationContext applicationContext ;
12+ private static IEntityManagerProvider entityManagerProvider ;
1113
1214 @ Override
1315 public void setApplicationContext (ApplicationContext applicationContext ) throws BeansException {
1416 ApplicationContextUtil .applicationContext = applicationContext ;
17+ ApplicationContextUtil .entityManagerProvider = applicationContext .getBean (IEntityManagerProvider .class );
1518 }
1619
1720 public static ApplicationContext getApplicationContext () {
1821 return applicationContext ;
1922 }
2023
2124 public static EntityManager getEntityManager (){
22- return applicationContext . getBean ( EntityManager . class );
25+ return entityManagerProvider . provide ( );
2326 }
24-
2527}
You can’t perform that action at this time.
0 commit comments