Skip to content
Advertisement

Tag: spring-data-jpa

Spring jpa database connection for native query

I have a spring application that have to connect to a sql server db. There are no @Entity class and there ate no @Repository because the tables and the columns of the tables are unknown to the application. I have created a class and used an entity manager to execute queries, but I’m not sure this is the best choice

How to search in parent entity scope when using spring boot data rest

Now I know how to findBySomething on root level entity. Let’s say I have a one to many relation of class -> student I can now students/search/findByName?name=Tom But it will give me Tom in all classes. Can I do something like classes/1/students/search/findByName?name=Tom It gives error right now. Answer in StudentController in StudentService in StudentRepository (I use mongoDB; if u use

Spring data JPA: Three entities ManyToMany relations, query duplicate result with findById

User.java UserRole.java RolePermission.java JDK:17 SpringBoot:2.7.4 findById and findBy are also generate different structure SQL. findById uses left outer Join. findByName uses subquery. the user only have one role, the role have three permissions. if use findByUsername It will return the user info correctly. If I use findById, the same role repeat three times。 } code : https://github.com/shuanshuan/demo-questions Answer While fetching

Advertisement