Can someone convert c# to java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can someone convert c# to java

public class EfGenericRepository<TEntity> : IGenericDAL<TEntity> where TEntity : class, ITable, new() {}

25th Jan 2021, 7:07 PM
Vefa K
Vefa K - avatar
3 Answers
+ 1
thanks for answeriny yeah it's for spring i want to get rid of repeating of code in service layer ..for each entity i write findbyid create delete ,remove methods so I want to write generic class
25th Jan 2021, 9:18 PM
Vefa K
Vefa K - avatar
0
Using Spring Data? No implementation needed, most of work are made transparently using proxies, and could be something like that... @Repository public interface FooRepository extends CrudRepository<Foo, Long> { ..... } or extends from PagingAndSortingRepository<Foo, Long> if need extra support pagination/sorting in findAll methods. NOTE: Long is the type of the Entity property annotated with @ID (a.k.a Primary Key) Take a look at reference documentation: CORE: https://docs.spring.io/spring-data/commons/docs/current/reference/html/ JDBC: https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/ JPA: https://docs.spring.io/spring-data/jpa/docs/current/reference/html/
25th Jan 2021, 8:20 PM
David Ordás
David Ordás - avatar
0
With Spring, no implementation class is needed. The Framework is in charge of, following a simple rules, transform method names to sql/jqj... using configured dialect through proxies HERE Api docs https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/PagingAndSortingRepository.html
25th Jan 2021, 9:54 PM
David Ordás
David Ordás - avatar