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
-
0
votes0
answers22
viewsHow does the <class> tag work in the persistence.xml file in jpa?
Good night. I’m starting in jpa studies, and in a moment I came across the following situation, I filled in the persistence.xml file as follows: <?xml version="1.0" encoding="UTF-8"?>…
-
0
votes0
answers13
viewsHow to set a postgres function parameter using Native query?
Good afternoon! I created a Native query that uses a postgres function date_part(text, timestamp). My code: String sql = "SELECT " + "(SELECT coalesce(count(*), 0) FROM public.cliente) AS…
-
0
votes0
answers13
viewsHow to overwrite findAll with Examplematcher Jparepository
I am making a findAll using Jparepository and Exemple (Examplematcher). Entity Cidade public class City implements Serializable { private static final long serialVersionUID = 1L; @Id…
-
0
votes1
answer47
viewsManytomany jpa - Spring Save Relationship Entity Data
Good night, you guys! I have 2 classes: Services and Order. Services contain name and value/time. Request contains attributes: valueBrut, valueLike, percentualTime , user and a list of services.…
-
0
votes1
answer75
viewsSave daughter entity against Manytoone Hibernate Jpa
I have 3 entities: Request, Request and Service; There is a many-to-many relationship between the Request and Service entities so I created the third table; I would like to save a Request and also…
-
0
votes1
answer27
viewsHow do I search the database using a String in an Apirest?
Hello, class! I am studying developing Apirest with Spring Boot. But I am facing problem when I will make an appointment through String. Through id works normally, but when I add the search method…
-
-1
votes1
answer2491
viewsSend email with java
Good afternoon. I’m using java, JPA, wildfly and primefaces. You need to send a notification email after the user clicks on the send button. How do I send emails through java?
-
-1
votes1
answer457
viewsEdit Record Using Jpa
Good morning Personal, I’m trying to edit record. well the scenario is the following have my screen edit that is bringing me the data correctly. but when I do the editing it updates on the screen no…
-
-1
votes2
answers1469
viewsTarget Unreachable error, Identifier 'Clientebean' resolved to null
System with error: Error message: Caused by: javax.el.Propertynotfoundexception: /index.xhtml @22,72 value="#{Clientebean.cliente.name}": Target Unreachable, Identifier 'Clientebean' resolved to…
-
-1
votes1
answer372
viewsConfiguration EAR+Hibernate 5.2+Maven+JTA+Mysql project
Hi, I built a Maven j2ee-EAR project, but I’m having trouble setting up Hibernate/JPA. I added the dependencies in pom.xml, as below: <dependencies> <!--…
-
-1
votes2
answers790
viewsNull return for List<String> method
I have a method with return type List<String>, when a query is made I can return a value or nothing: public class Repositorio { @PersistenceContext private EntityManager em; public…
-
-1
votes1
answer862
viewsBuilding select in HQL
I’m starting to use JPA with Hibernate and I’m having doubts about the HQL query, I did some research on the Query hql but I couldn’t understand much. I want to do this select in hql only I did not…
-
-1
votes1
answer183
viewsSet column order in database using Springdata
I would like to know if it is possible (if it is, how to do) to define the order of the columns in the banco de dados using JPA. I noticed that it creates the column Id first, and then the columns…
-
-1
votes1
answer84
viewsJoin with criteria
I have the following entities: public class Mapa { //many to one private ItemMapa itemMapa; } public class ItemMapa { //many to one private Classe classe; } public class Classe { private Long id; }…
-
-1
votes1
answer62
viewsHTTP Status 404 - Not Found - with Spring, Hibernate, Jpa, Mysql eTomcat
I made a change in my project passing the responsibility to Spring to control the transactions according to Caelum documentation and other examples I searched the web, already searched for…
-
-1
votes1
answer195
viewsSpring Boot and Hibernate - problems to move up application and map classes into entities
the thing is, I created a page using Spring Boot, Thymeleaf, Hibernate e Mysql para cadastro de estacionamentos e veículos mas estou muito perdido em relação ao mapeamento das entidades e…
-
-1
votes1
answer851
viewsError adding students to a class 'The Given id must not be null! '
When I click on Include student appears this error but I do not understand why, someone to give me a light, thank you. Console error java.lang.Illegalargumentexception: The Given id must not be…
-
-1
votes1
answer120
viewsHow do I leave my Hibernate (Spring Boot) dynamic query?
Hello I am trying to let my dynamic query down as follows: @Query("SELECT T.NR_EVENT FROM TB_TIMELINE AS T WHERE T.NR_PENUMPER = :customerCode") public List<TB_TIMELINE>…
-
-1
votes1
answer56
viewsHow to fix 1892 Spring startup error?
When I start my project in Spring Boot it appears to me this error: More information about the error: 2021-02-10 19:41:35.984 INFO 1892 --- [ restartedMain] com.produtos.apirest.ApirestApplication :…
-
-1
votes1
answer206
viewsjava.lang.Classcastexception: class java.lang.Integer cannot be cast to class java.lang.Void
I am trying to perform an UPDATE in the User table, but when doing Ubmit error occurs. I’m having a hard time understanding what the mistake is about, could you help me? below is my code and the…
-
-1
votes1
answer46
viewsHow to make a Onetoone in JPA with composite primary key?
How to put a User inside Serveruser? I tried it like this. It creates the database, but it keeps throwing me an exception And also he is creating a new user_idd field, would like to use the user_id…
-
-1
votes1
answer65
viewsError trying to email in a spring boot project
I have the following error when I try to send an email in a spring boot project: javax.mail.Messagingexception: Could not Convert socket to TLS;…
-
-1
votes1
answer16
viewsFetch.Azy keeps loading the attribute what can it be?
Even if I use Azy my list is loaded, someone knows what’s going on? public class Departamento { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotEmpty(message="O campo…
-
-1
votes1
answer17
viewsHow to define which data of an ENUM the JPA will persist in the bank?
Hello, I would like to know how to annotate a property (ID) of my ENUM for when to persist in the bank? Because currently JPA is saving the index of the Enum array and not the ID... My Enum: @Getter…
-
-1
votes1
answer181
viewsJPA Eclipselink - No entity update
I have a relationship in the JPA of Client 1 -> 0.. * Loans. So I have in the client class a set Loan List to make the Onetomany. It turns out that when I add a customer he updates the normal…
-
-1
votes1
answer954
viewsManytomany mapping with additional column
In my study project, aimed at controlling football matches, I have the following entities: Gambler Name; Departure Date of implementation; Gols pro; Goals against; I still need to record the goals…
-
-1
votes1
answer200
viewsCondition IF, ELSE
I have a Java Spring MVC application, with Hibernate and JPA and HTML interface. I have Two forms that depend on the Notebooks class registered and its attributes. The forms have the following…
-
-1
votes1
answer136
viewsError exceptions.Optimisticlockexception when trying to perform UPDATE with JPA
I’m having trouble when I try to perform an update with JPA with the instruction: ObjetoDE = thisObjetoBF.update(ObjetoDE); ERROR: Exception [EclipseLink-5010] (Eclipse Persistence Services -…
-
-1
votes1
answer62
viewsHow to persist data using JPA concatenated key in the @Manytomany relationship?
I have the first entity private static final long serialVersionUID = 2405172041950251807L; private static final String CAMPO_CODIGO = "CODIGO"; @Id @GeneratedValue(strategy =…
-
-1
votes1
answer60
viewsConfigure JPA to recognize uppercase Postgresql entities and tables
Recently I am working in a project that uses as DBMS Postgresql. In the database all tables and columns are in "UPPERCASE". Example: CUSTOMER - ID_CUSTOMER - NAME - DESC When it comes to mapping…
-
-1
votes1
answer66
viewsHow to pass multiple lists in a query? Using JPQL
The problem is this: I have a controller that receives a list of Integers: [1245,12346 ...] In my table I need to consult using this list but the columns are separate, IE, the first digits are in…
-
-1
votes1
answer37
viewsError when selecting data saved in BD via a <p:Selectonemenu>
I’m having trouble loading a user’s data into the form. Man selectOneMenu is loaded(correctly) with a list of guys however the TYPE object entered in the User record is not being selected during…
-
-1
votes1
answer527
viewsHow to popular a list to DTO more simply
To show the list of a register in my system, I populate the query in a DTO as below. My question is: There is a simpler way to popular the query in the DTO list? public List<ObjetoDTO>…
-
-1
votes1
answer20
viewsfindAllbyId bringing the same result to the whole query
I’m having a small problem, my query is returning the same result on all Rows. Example: Code: @NamedQuery(name = "UtilizadorPerfil.getByFilter", query = "SELECT u FROM UtilizadorPerfil u WHERE…
-
-1
votes1
answer32
viewsError calling save method using JSF Hibernate JPA An established connection has been overridden by the software on the host computer
I am trying to save the data from my form but when I click save of error saying that "An established connection was annulled by the software on the computer". But when I test the save method using…
-
-1
votes1
answer217
viewsPrimary key composed of two foreign keys
Good afternoon to you all! I have a doubt in the structure of an Entity, I am using Hibernate+JPA. The class is a user rating, where one primary key will be the user (coming from the User class),…
-
-1
votes1
answer54
viewsRandom class doubt in Java
Guys I’m trying to create a system of numbers mega sena. Basically I have to have a client(id) that will generate 6 random numbers. public class Cliente implements Serializable { private static…
-
-1
votes1
answer56
views -
-1
votes1
answer19
viewsWhy when I use spring boot save method it changes the persistence of the data in several places?
Talk personal, all right? In my context, I need to do an undo method, this out using an array object that saves in memory my last given database persintência and, when saved this data in the array…
-
-1
votes1
answer91
viewsHow to validate Date type with Springboot validation bean?
Gentlemen, I would like to know from you, how are you validating Date type fields in Spring-boot with Bean Validation? I used the note @DateTimeFormat but I did not get the expected return, and the…
-
-1
votes1
answer28
viewsExclusion of related tables
Good morning, I am trying to delete my user class but am having the following error "Cannot delete or update a Parent Row: a Foreign key Constraint fails (pitangdb.phone, CONSTRAINT…
-
-1
votes0
answers11
viewsHow would be a good practice to create a new standard record for entities?
How good would be a practice to create a new default record of the entities below? I need this because front-end requirements require at least one record for an editable table to be shown. I thought…
-
-1
votes0
answers12
viewsHow to capture inheritance data with mapstruct?
I am creating an API with Spring and there was a need to make inheritance for different types of users. My entity structure follows as follows: @MappedSuperclass @Getter @Setter…
-
-2
votes1
answer167
viewsHow to remove entity classes from Java Persistence mapped in a deleted project?
Database entity classes mapped in a previous project that was deleted continue to appear if I create a new project with the same name. How to Resolve with Netbeans 8.2 and Glassfish 4.1 Application…
-
-2
votes0
answers17
viewsImplicit column Reference in the @Mapsid Mapping fails, Try to use Explicit referenceColumnNames
I have these tables in my database: create table movimentacao ( id bigint not null, usuario_id bigint not null, data_entrada datetime not null, data_saida datetime, periodo_permanencia…
-
-2
votes2
answers156
viewsjava.lang.nullException error
I am developing software for a video rental company with Pattern MVC (Model-view-controller) design with the Java Persistent Api Framework and the XML (Generic Markup Extensible Language). My…
-
-2
votes1
answer150
viewsHow do I leave a JPA transaction with Spring open?
I would like to know how to leave a JPA transaction with spring open, today I use the annotation @Transaction what happens is that every time I want to carry some attribute that is not like EAGER…
-
-2
votes1
answer188
viewsPrimary key generation problem spring-boot-jpa
I’m creating a little project using spring boot,: org.springframework.data.relational.core.conversion.DbActionExecutionException: Failed to execute…
-
-2
votes1
answer213
viewsSpring data Jpa Lanca @Autowired error and null pointer error
I’m using Spring Tool Suite to make an application, but when I try to release the website’s html data to the database, the relative service method will save and generate persistence returns…
-
-3
votes2
answers192
viewsHow to make the findById method in spring-boot?
I’m making an Api where I need to get a user’s information through findById, but the STATUS in Postman is like 200 and did not display anything. Code below. controller @RestController…