Most voted "jpa" questions
The Java Persistence API (JPA) defines a path to map Plain Old Java Objects (Pojos) to a database, these Pojos are called entity Beans.
Learn more…652 questions
Sort by count of
-
1
votes1
answer426
viewsValue '0000-00-00' can not be represented as java.sql.Date
I need to take a table called history the last three months and a year before to register in the product table. The code is as follows: for (int i = prod.getHistoricos().size(); i >= 0; i--) { if…
-
1
votes1
answer151
viewsHelp with JPQL query
I am trying to return a group query together with the product entity by returning all the data from the product table and the sum of the quantity. I get a mistake which is this: Exception in thread…
-
1
votes0
answers46
viewshow to use query with more than one field (Moldel .vo) in a datamodel
I have the following query and I am willing to put this list with products and the sum in a datamodel list. public List<Filtro> listarProdutosDoGerenteRegional() { try { return…
-
1
votes0
answers144
viewsJPA does not update children record
I have a little problem with JPA which is the following, I have the class ModeloEstoquePecas, where theoretically I need to delete everything first, which are the children’s records of the class…
-
1
votes1
answer3293
viewsIllegal Attempt to map a non Collection as a @Onetomany, @Manytomany or @Collectionofelements
Good night. I have the following mistake in Hibernate: org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements:…
-
1
votes0
answers328
views -
1
votes1
answer219
viewstenant application for multiple users
Well my doubt and while the approach of creating a database in the following scenarios Multiple Database, a user-created database Multiple Schemas, well would have only a single database, but each…
-
1
votes2
answers70
viewsMaintenance problem with JPA query
I have the following packages and classes. When I’m going to do this JPA consultation, I need to go through the whole full Qualified name of the Class (as in the example) because JPA cannot find it…
-
1
votes1
answer293
viewsDatasource Postgresql Widlfly
I’m trying to set up a DataSourcewith PostgreSQL, but you’re throwing this Exception 23:36:46,381 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) WFLYCTL0013:…
-
1
votes0
answers656
viewsProblem using @Jsonignore Spring Boot
I have a @Manytoone relationship between Manga and Author, where Many Manga can have an Author and an Author can have many Manga. I would like to list all the Manga with each Author, and when…
-
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
votes0
answers88
viewsRollback to persist entity with Hibernate
I have an entity Product: @Entity @Table(name = "produto") public class Produto implements Serializable { private static final long serialVersionUID = 1L; private Long id; private Cliente cliente;…
-
1
votes1
answer100
views -
1
votes0
answers95
viewsProblem persisting in SPRING-DATA/JPA using Composite Key / Does not return Generated Id
Hello someone already had this problem, when saving a class with composite key, the Spring Data API does not return with the generated id? I ran a test with primitive classes with unique id so it…
-
1
votes1
answer117
viewsJPA - There is the possibility of using Matchmode.ANYWHERE with Predicate
Usually when I need to do a search picking up a result through a single word, using Criteria and Restrictions I do as follows: criteria.add(Restrictions.ilike("nome", filtro.getNome(),…
-
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
votes2
answers61
viewsRelationship problems @Manytomany
Good afternoon Personal I’m having trouble in a relationship @ManyToMany. I have the class Equipamento and have the class Fornecedor, where I can have a supplier who has various equipment and where…
-
1
votes1
answer313
viewsMap relationship between tables without Foreign key
I have two tables in postgresql: schema1.immobile idt_imovel | int cod_imovel | string nome_imovel | string etc... schema2.declaration idt_declaracao | int cod_imovel | string status | string etc...…
-
1
votes1
answer346
viewsJoin fetch multiple returning duplicate values JPA Criteria API
In the method in question I want to return the consultation with the joins of employee and company. However, the Company class is related to the Query and the Employee, and is returning duplicate in…
-
1
votes1
answer257
viewsPersistence in JPA Cascade
I’m trying to perform a cascade persistence using JPA. I have the entity: Course and Module 1 Course can have several Module @Entity(name = "course") public class Course extends BaseEntity { private…
-
1
votes1
answer460
viewsJasper with JPA connection
I’m in a Java Desktop project using JPA, just to send a few reports where I’m using Jasper. Reports have sql queries the user interface will only pass parameters for data filtering. I found it…
-
1
votes1
answer245
viewsRelationship of one column to several
I have an entity class called Doctor, in which it has an Idmedic column. It relates to the class entity Care, which in turn has an Idmedico column, which would be a foreign key of this first. There…
-
1
votes1
answer153
viewsError doing Many to Many interface with Spring Boot
I’m trying to make a phone call Many-to-Many between classes usuario and permissao, using the documentation of Hibernate as reference . But when I try to generate a class JSON file usuario the…
-
1
votes1
answer387
viewsQuery with JPA filtering by Entity List
I’m performing a system in Java using Springboot and JPA, being event management and have two entities: Inscricao and HorarioAtividade. They have a relationship Many To Many, with my class Inscricao…
-
1
votes2
answers592
viewsSpring Modelling JPA Person -> Personal Modelling -> Function
I did the data modeling (UML) but at the time of implementing I’m doubtful how to do. I wish there was only one table Person. In that table person I would have the field tipoPessoa("p","f") and…
-
1
votes1
answer93
viewsHibernate no Excludes
Good night, you guys... I’m learning hibernate and I had a problem: I was able to insert, retrieve the BD data... I had a setback that I fixed by adding the following command line in the execution…
-
1
votes0
answers98
viewsClass Relationship with Primarykey Composite in Hibernate
I have the following relationamento In the Definition Scale entity I have a composite primary key composed of idEscalaDetailing and idTurma I’m having doubts to do the reverse mapping between…
-
1
votes1
answer1238
viewsJPA error with Mysql 8
Hello, After updating my database, my application has been presenting exceptions, like java.sql.Sqlsyntaxerrorexception. The class below is the one he complains about, saying it doesn’t exist when…
-
1
votes1
answer156
viewsError generating Id automatically in Hibernate
I am making an application with Hibernate, but is generating and error: "ids for this class must be Manually Assigned before Calling save()" The class that’s saying you’re wrong is like this..…
-
1
votes1
answer536
viewsNo Persistence Provider for Entitymanager named
Guys I’m studying about the Ibernate framework with JPA in a simple example of guy I’m already having problems and my research did not take me anywhere to solve my problem. that’s the mistake you’re…
-
1
votes1
answer227
viewsHow to create a business rule by JPA?
I need to implement a business rule that ensures that the same employee represented by the table Employee cannot be added more than once to the same project represented by the table Project. Let me…
-
1
votes0
answers83
viewsJPA - Entitymanagerfactory - Slow execution
Expensive, I am playing with Persistências and something strange occurs when running from the eclipse. The same does not occur when running in the jar. Has anyone been there? Eclipse Photon (4.8.0)…
-
1
votes1
answer53
viewsDo not re-enter an existing login user
I have a JPA problem with Java. I built a login system, using a self-generated ID, but every time I run the program it creates another user in the database, with a different id but same credentials.…
-
1
votes1
answer1575
viewsReceiving object by parameter
I’m using Spring MVC and use some mapping to receive an object for example and access that specific object in controller. For example: @GetMapping("/pessoa/{idPessoa}") public ModelAndView…
-
1
votes1
answer122
viewsThe Annotation @Persistencecontext is disallowed for this Location
I’m getting the message "The Annotation @Persistencecontext is disallowed for this Location" when I try to put this annotation in the code, someone knows how I can fix it? @Stateless public class…
-
1
votes1
answer721
viewsHow to create a @Onetomany relationship in JPA, in 3 tables that already exist in the database?
I want to create a relationship @OneToMany in JPA using 3 tables I have already created in my database (I don’t want it to create the tables for me), the tables are Usuario, Perfil and…
-
1
votes2
answers248
viewsNull return for a JPA method
I have a method in my Pository that searches for a specific user’s last minute and a specific date as well, both passed as argument. However, if there is no record on the last date it returns null…
-
1
votes0
answers106
viewsDatabase cache not being stored by Springboot
I am trying to store the cache of a database search made through JPA, for that I am using the annotation @Cacheable of the package org.springframework.cache.annotation upon the method…
-
1
votes0
answers38
viewsHow to persist and query embeddable entities that have no bidirectional relationship using Jparepository
Using as an example a hotel booking app, I have something like public class Reserva{ ... @CollectionTable(name = "custo_extras", joinColumns = @JoinColumn(name = "reserva_id")) private…
-
1
votes0
answers141
viewsEntity Creation with Migration (JPA / Flyway) - Error Creating bean with name 'entityManagerFactory
Good evening! I am having difficulty in carrying out the relationship of the entities and getting the following error below. I have tried to use other relationships, but to no avail. User may have…
-
1
votes1
answer76
viewsReturning only the last value of a table and filling a collection via JPQL
I have the following tables in the database: CLIENT ID | NAME | CPF BUYING ID | DESCRICAO_ | DATA | ID_CLIENTE the CLIENT table with the columns id, name and Cpf the PURCHASE table with the columns…
-
1
votes1
answer225
viewsInheritance JPA Inheritance.JOINED does not work as it should
Hello, I have the following classes Person, Personal and Personal. The last two classes share the same primary key of the class Person, that is, the primary key and foreign key of the tables…
-
1
votes1
answer448
viewsHow to filter selected fields through Spring JPA using JPQL?
I would like to know how to proceed to filter selected fields using JPQL within the JPA/Hibernate implementation? The following scenario will be presented to facilitate understanding, following…
-
1
votes1
answer60
viewsSpring-Boot - Accessing Jparepository outside the Controller scope
Hello, I have a web application based on Springboot, but that also treats a specific protocol and for this I start a Serversocket that waits for connections and treats them appropriately. Below is…
-
1
votes1
answer46
viewsI cannot upload two files to the same document in a Manytoone interface
Hey, guys! Good night. So I have an entity called files and another entity called document. A document can have multiple files. I made a file upload module. The problem I’m facing is that when I…
-
1
votes1
answer103
viewsProblem with JPA Hibernate
I have a problem in a system that I am developing using springboot together with JPA Hibernate. I’m not so experienced using them, so forgive me in advance. Let’s get to the problem: I have 2 tables…
-
1
votes2
answers215
viewsHow to map class fields with names other than database columns?
I’m using IDE Intellij. I have the following model: @Entity(name = "carro") @Data public class Carro { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String nome;…
-
1
votes1
answer46
viewsHow to change the result of requesting a Rest API with Spring?
Eai guys, all right? I started studying Spring recently on my own and am trying to create a Rest API for enrolling students and exams at a school. I have the following problem: When I make a GET…
-
0
votes1
answer76
viewsPreventing entries from being deleted using Hibernate
Is there any way I can set that certain table entry in the database is not excluded? For example, I created a table usuários on the bench through the class User using the annotations of Hibernate…
-
0
votes1
answer99
viewsChange of entity reflect on related entities
I have two entities, for example: Note: Fictional code to facilitate understanding of the problem. @Entity public class Celular{ @Id @GeneratedValue(strategy= GenerationType.IDENTITY) private int…