Most voted "spring-jpa" questions
Spring JPA is an integral part of the Spring Framework used for JPA management (Java Persistence API).
Learn more…91 questions
Sort by count of
-
7
votes1
answer297
viewsMulti Tenancy with Hibernate update schema
Hello I am with an application that uses multiple databases (multi-tenancy) using Hibernate. I wonder if anyone knows any way Hibernate can update the bank schema. I’ve already set the property…
-
4
votes4
answers4853
viewsWhat kind of return of a select Count(*) in Spring JPA?
I need to know the type of return that Spring JPA returns to put in the Service package, because it is giving a NullPointerException: Dao: public interface PlaylistDao extends…
-
4
votes0
answers368
viewsERROR: null value in column "id_municipio_id_municipio" violates the non-null restriction
This error is occurring when I try to persist the screen data to the database. I checked, by debugging the screen, that the data is being captured. When the method exits line 33 of the image it goes…
-
3
votes1
answer914
viewsCircular dependency on Rest API with Spring Boot
I’m venturing into developing a Rest API using Spring Boot, JPA with Hibernate and Maven to manage the repositories. In my modeling I have a class Club: @Entity @Table( name = "CLUB") public class…
-
3
votes2
answers313
viewsSpring data Jpa implement generic methods
I have 3 services with these methods in common create(),deleteById(),findAll(),getById() and update(). @Service public class AutorService {create(),deleteById(),findAll(),getById(),update(), etc...}…
-
2
votes1
answer311
viewsRepository - Record Filter according to user permission
Searching on how to filter records with Restpository, I found the annotations: @Preauthorize @Prefilter @Postfilter It has 2 roles in the system: ROLE_ADMIN and ROLE_USER and ROLE_ADMIN can access…
-
2
votes1
answer3603
viewsSpring Boot application does not rise - org.springframework.Beans.factory.Unsatisfieddependencyexception
I created the application from SPRING INITIALIZR. I made the adjustments for the first operation and configured the application.properties however I continue to receive the same exception:…
-
2
votes0
answers158
viewsHow to return a MAP using JPA’s native Query?
I need to consult a bank that is already established, populated and maintained by another application. So I don’t have the entities in my project and I didn’t want to create. I am using Spring Boot…
-
2
votes0
answers59
viewsSpring JPA - Procedure call with sqlserver dialect
Hello, I have the following configuration in my application file.properties: spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver spring.jpa.hibernate.dialect=…
-
2
votes3
answers131
viewsMultiple query values with JPA/Sprint and Rest
Good morning, I need to make a query via REST where multiple ID will be sent for example (ID: 1, ID: 2, ID:3, etc). To search only for an ID I use findById(codigo), but I don’t know how to use…
-
2
votes1
answer407
viewsDoubt about mapping with Java
I created a project by putting system authentication including login and password directly in the Java code, but I know this is super wrong, the most recommended for implementation of authentication…
spring-jpaasked 7 years, 5 months ago wladyband 4,694 -
2
votes1
answer48
viewsOnetoone returning wrong value
Guys, help me please, I’ve got a problem here and I’ve been racking my brain trying to figure this out for hours. I use Spring in the project and have the following relationship in one of my models:…
-
2
votes2
answers12692
viewsError Creating bean with name 'entityManagerFactory' defined in class path Resource
Good night, I have an application using Spring boot 1.5.10. I’m trying to make the connection to the oracle database, but I always have this title error. Attempts: I went back to the spring boot…
-
2
votes1
answer39
viewsHow best to relate this entity
in my application I have a user entity that relates many to many with the entity courses (a user can enroll in many courses and a course can have multiple users) And the entity courses relates from…
-
2
votes1
answer345
viewsRelationship between Rest Resources with Spring boot
I’m learning Spring Boot Rest and with a doubt I can’t solve on my own, you could help me? I created the following mapping between Launch and Person entities: Entidade Pessoa: @Entity public class…
-
2
votes1
answer23
viewsPUT problems with Spring data JPA
I’m using Controller architecture, DTO, Repositoy, Service Use Postman to test the requests, I can do POST on User normally and when I do GET Postman returns me { "id": 3, "nome": "Arthur", "cpf":…
-
2
votes1
answer1387
viewsSpring Boot, ultilizar outro campo de busca além do @id
I am making an API with Java with Spring boot and I would like it to search for CPF and not ID; http://localhost:8080/pacientes/ID http://localhost:8080/pacientes/Cpf (sera informado pelo usuario)…
-
2
votes1
answer258
viewsRequest made to Spring Boot is returning another endpoint API
I set up a test scenario to treat an error that was happening on my frontend. Situation Problema: The problem was that I was making a requisition for a route ‘/api/v1/telefones’, Spring ends up…
-
1
votes1
answer694
viewsSpring JPA XML error
After I updated the Eclipse of the Luna version to the Mars version is returning error in the first line of the Spring JPA XML file, in the XML declaration: <?xml version="1.0"…
-
1
votes1
answer955
viewsUse "WHERE IN()" clause in SPRING BOOT JPA?
Does anyone know how I can use any clause similar to WHERE IN in the spring jpa? example: @Modifying @Transactional @Query(value = "Delete from table where id in(:ids)",nativeQuery=true) void…
-
1
votes1
answer1247
viewsDeleting children records with @Manytoone annotation from Spring JPA
I have the classes Presente and Reserva, as below: @Entity public class Presente { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long codigo; private String nome; //getters e…
-
1
votes1
answer576
viewsPass native query by parameter to Jparepository Interface
I need to create an interface that extends Jparepository where I want to pass a native query(select) by parameter instead of leaving static inside the annotation @Query. Instead of using…
-
1
votes0
answers139
viewsDynamically connect to the database by the Spring project’s Repository class
I need to connect to the database in a dynamic way, where the database connection data can be passed by parameter, below is an outline of how to need the connection and execution of the query. This…
-
1
votes1
answer5444
viewsHow to map entities with composite keys in JPA?
I have a system where all tables in the database have a column empresa, which is part of PRIMARY KEY. In the client table, I have a column id (autoincrement), which together with the empresa form a…
-
1
votes1
answer171
viewsError integrating Spring 4 + Hibernate 5 + JPA 2 and Glassfish
I’m unable to start the Spring transaction, it’s some configuration I made wrong who can help me. follow the codes: java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()…
-
1
votes3
answers462
viewsHow to limit a user to only access their own data?
I am developing a task list application for study, however, all users access all tasks. I wonder if anyone has ever implemented something like this with the Spring Security and how you did.…
-
1
votes0
answers133
viewsHow to apply filters to database queries on all requests
I am developing an application using Spring Boot and Spring Data JPA that will work similarly to a blog. In this application there are three different types of user and each user will belong to…
-
1
votes2
answers2178
viewsPersisting a Spring Boot Relationship
I have the following Entity classes Patients @Entity @Table(name = "pacientes", schema = "sau") public class Pacientes implements Serializable { private static final long serialVersionUID =…
-
1
votes2
answers735
viewsMultiple Databases with Spring Boot
In my application, customers have their own database and I am developing a REST application, with Spring Boot, from which I need to configure Datasources to connect to databases, according to a…
-
1
votes1
answer447
viewsWhen I make a request on my Rest API with Spring boot, it is coming with an extra item
I have debugged and the result is coming out a correct list, but when I request in Postman, comes an extra item. Looks like a counter. Can someone tell me what this is and how to take? This is my…
-
1
votes1
answer55
viewsJakartaee vs Spring vs Java SE with JPA
Speak for me, baby? Reading the Oracle documentation I found the following excerpt: @Persistencecontext protected Entitymanager entityManager; Hence the EJB container will inject a standard Unit…
-
1
votes2
answers1009
viewsSpecification with Spring Data Jpa passing null parameter
I’m using the Specifications Spring Data JPA, but I’m having a hard time! By not passing any parameter in the two fields I want it to return all records to me. But when making the query it is…
-
1
votes1
answer685
viewsOmit DTO (Spring Data JPA) attribute
Hello, I have two DTO classes (Categoriadto and Productodto) in a restfull application, how can I omit a certain attribute of Productodto when it is used in the Categoriadto class? Below follow the…
-
1
votes1
answer592
viewsspring boot modules via Maven do not interact
I’m using Spring Boot to create a Restful web service and a SOAP, each in a module but both in a single project. So I decided to separate my domain layer into a third module since it’s the same for…
-
1
votes1
answer597
viewsSpringboot - JPA - does not migrate relationships in the entity and relationship diagram
I am creating a Rest application using Springboot, JPA and as a Mysql database. It works well, but it has something strange when I enter the database. I used Workbench to create the relational…
-
1
votes0
answers308
viewsLocaldatetime advancing two hours when submitting form
When I will submit a form with the class Localdatetime managing the time and date fields, it advances two hours. I noticed this advance with the time of my computer. Code: package…
-
1
votes2
answers3560
viewsHow to fix the error: cannot deserialize from Object value (no delegate- or Property-based Creator) using Spring Boot?
I am trying to send a JSON to my Spring method for entry into the database but I get the following message: JSON parse error: Cannot construct instance of br.com.marketHubServer.model.Collaborator…
-
1
votes1
answer57
viewsWhy does spring data persist when I use a set?
I have a method more or less like the following within a service: @Transactional public void atualizarPosicoes(Integer novaPosicao, Long idTarefaAtualizada){…
-
0
votes2
answers1239
viewsPagination with spring date
I have a list of clients per seller and am trying to create a pagination to show 10 and 10 clients in my modal in PHP. If anyone can help me thank you, because I’m still not good at spring date.…
-
0
votes1
answer83
viewsJPA entity generating column with double name id_municipio_id_municipio
I have an entity called districts that contains a relationship with the municipality table. When I run the database the districts table creates the id_municipio_id_municipio field and it was to be…
-
0
votes1
answer4559
viewsError resolving template "Meutemplate", template Might not exist or Might not be accessible by any of the configured Template Resolvers SPRING
Performing an ajax request function buscarDisciplina(){ var codigoDisciplina = String($("#codigo").val()); $.ajax({ url: urlApplication+"/grade-curricular/buscar-disciplina/"+codigoDisciplina, type:…
-
0
votes1
answer100
viewsFloat with Spring null value
I have an application with Spring Data. Calling the Spring findAll() method, there are null values in the database. When setting the object the field comes with null value triggering the error…
-
0
votes2
answers919
viewsJSON Infiito when using GET @Manytomany
I have two classes, of which you have a @Manytomany relationship generating the third table described in the code below: Card package br.com.rpgnext.deck.critical.model; import…
-
0
votes0
answers205
viewsHow to run database call with JPA parameter
How do I call a stored procedure from the bank I have the following procedure stored in the database, and I wish to execute your call by passing the parameter projId, using JPA to pick up the…
-
0
votes1
answer188
viewsRefactoring for Spring Data returning List<Object[]>
I came across a project where I have several methods in Repository of this kind: @Query(value = "SELECT " + " i.uf, " + " i.cidade " + "FROM Imovel AS i " + "WHERE i.ativo = 'Sim' AND " + " EXISTS…
-
0
votes1
answer451
viewsHow do I resume the amount of Spring JPA records?
I want to return the value of playlists at the bank, but that code there did not work. public interface PlaylistDao extends JpaRepository<Playlist, Long> { @Query("select count(*) from…
-
0
votes1
answer244
viewsPersistence with Spring and Thymeleaf in multiple tables in the same form
I have another vision How can I pass two objects in Modelandview, so that when calling a request to save I can do this object distribution for each Entyti. I have Entyti Client and Contact, in the…
-
0
votes0
answers88
viewsError org.hibernate.dialect.Firebirddialect does not support Identity key Generation
This error appears when I go to save an entity in the database. I have configured the Entity class and the Repository in several ways, but the error remains. I am using Firebird 2.5. The table…
-
0
votes2
answers234
viewsSpring boot keeps session open
I’m having trouble with my Spring boot api, I’m using JPA (Entitymanager), when startar the application is already open ten sessions without even making any request, already tested in three…
-
0
votes1
answer69
viewsHow to set UTF-8 encoding in data.sql files for starting H2 data based with Spring?
I have a Spring JPA application with an H2 database. I created a data.sql file with some INSERTS and this script is running normally on application startup, but the special characters are being…