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
answer4739
viewsorphanRemoval JPA
How orphanRemoval works? Why when I put it on a list does not work ex: @OneToMany(mappedBy = "simulationMedia", cascade = CascadeType.ALL, orphanRemoval = true) @JsonIgnore private…
-
1
votes2
answers140
viewsAND operators and OR
I recently started using the Criteria API because I need to make queries that would be very complex with HQL. How I use the operators AND and OR in queries with Criteria API?…
-
1
votes1
answer438
viewsNull object fields when trying to persist with JSF and JPA
I am trying to persist an entity and when I try to persist it plays an error of Constraint Violation, performing the debug, I noticed that the object is instantiated but the fields are null.…
-
1
votes0
answers125
viewsError calling Webservice that returns a list (JPA)
Hello, I am unable to return a list of orders by Webservice: public List<Pedido> getPedido() throws Exception { String query = "SELECT p FROM Pedido p"; TypedQuery<Pedido> typedQuery =…
-
1
votes1
answer1310
viewsJPA - Two Onetoone and Onetomany relationships between the same class
I own a student class and she has two relationships with Pessoa one OneToOne and OneToMany and person in turn a relationship with Endereco, as shown below: Classe Estudante @Entity @Table(name =…
-
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
votes2
answers419
viewsHibernate ORDER BY ASC|DESC does not work by passing parameter
Well, I’m having a problem ordering a query, where I’m passing the name of the field along with ASC or DESC as parameter for the query, however Hibernate is not finding itself, returning the query…
-
1
votes1
answer775
viewsProblems with Nullpointerexception in a JSF project
I am with an application that is displaying the following error message; jun 01, 2015 4:15:05 PM com.sun.faces.lifecycle.InvokeApplicationPhase execute ADVERTÊNCIA: #{pesquisaPedidosBean.pesquisar}:…
-
1
votes0
answers54
views -
1
votes0
answers107
viewsDoubt about dependency injection in Customer Systems of Hibernate
I wonder if there is any way I can inject resources into an Hibernate Event Listener using vraptor 3.5. I wish I could simulate the behavior of a Rigger that we have in the database. And this…
-
1
votes1
answer752
views@Size, using Hibernate Validator, accuses error in value that should pass validation
I have a Java SE application where I can’t use the @size annotation. This annotation is worked out by the org.hibernate.Validator.Size. There is a user field in the model where I do so: @Size(min =…
-
1
votes1
answer91
viewsJPQL Query for Data Insertion
How can I enter a data with JPQL containing values: @Query("insert into user values()") User insertUser(); Dice: nomeUsuario emailUsuario…
-
1
votes2
answers233
viewsHow to make this consultation with JPA?
I would like two solutions to this question, one using a normal typedquery and the other using the criteria due to its great versatility for code. Here is my query: TypedQuery<Pessoa> query =…
-
1
votes0
answers619
viewsJSF Download File Saved in Database
Hello, I have a jsf page where I upload the data from a entidade, between the data there is an attached file (pdf, xls, jpg etc.). I would like you, when clicking on the file name, to download the…
-
1
votes0
answers94
viewsError displaying a collection of a contact’s phones and emails
I want to display on a XHTML page (JSF+Primefaces) a list of contacts with phones and emails. I can display everything I want in a test class: package com.fercosmig.testes; import java.util.List;…
-
1
votes1
answer309
viewsError in field validation
I have the following class: package br.com.pokemax.modelo; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import…
-
1
votes1
answer444
viewsSum values of equal items in a table
I am using JAVA, JPA, Wildfly and Primefaces, but I would really like someone to help me in a java method to sum values of equal items of a dataTable.Example: I have two columns PRODUTO and…
-
1
votes1
answer514
viewsThe find() method of my entityManager from DAO Generica is giving Nullpointer, how to correct?
The change of my DAO is like this: private EntityManager entityManager; public void alterar() throws Exception { System.out.println("T encontrada"); System.out.println("iniciando Alterar id: " +…
-
1
votes1
answer52
viewsQuery with jpa + Hibernate with more than one idt in clause
with Hibernate I can make an inquiry by idt as follows: entityManager.find(Empresa.class, idtEmpresa); And that would already return the mapped object of the company class, but what if I wanted to…
-
1
votes1
answer183
viewsUnderstanding the same method in Pository and in service
Why in the service and controller, do objects point to the same function? I’ll detail: Repository: @RepositoryRestResource(exported = false) public interface AtividadeRepository extends…
jpaasked 9 years, 2 months ago André Nascimento 1,258 -
1
votes1
answer254
viewsJSON Persist Creating List Objects
Good afternoon, everyone, I’m having a doubt, I try to persist a JSON through the API: { ... "Analise": [{ "nProcAnalitic": "SR-000446/2015", ... }] ... } And the service answers me 200: ...…
-
1
votes1
answer1878
viewsValidate date less than current date
My question is as follows. I have a JSP form for the registration of students with several attributes, one of them is the date of birth. Until then I was registering the date only validating the…
-
1
votes0
answers90
viewsPersist @Manytoone NULL
I have a User class and another Contact class which have a relationship between them. It’s all working correctly the question I need to only be recorded a contact if there is any contact attribute…
jpaasked 7 years, 11 months ago Jeremias Santos 403 -
1
votes2
answers717
viewsJPA error with Wildfly - No Persistence Provider for Entitymanager named Project
Hello! I am creating a very simple test application using JPA, Wildfly as application server and Oracle Database 11g Express Edition as database. The purpose of the Test class is to execute a People…
-
1
votes1
answer82
viewsSave only if not null
How do I map with Hibernate @OneToOne and save only if the information has data in the related table? Example: public class ObservacaoPessoa { @Id @GeneratedValue(strategy = GenerationType.IDENTITY)…
-
1
votes2
answers1959
viewsCall Stored Procedure with JPA 2.0
I need to call the following process below, only the company’s projects use JPA 2.0 and all the examples I find are for JPA 2.1 +. prc_performance_vendas_obter(vdataini => :vdataini, vdatafim…
-
1
votes2
answers1825
viewsDoubts how to leave a unique attribute - JPA
I am creating an entity, and I have a CPF field and this field that is unique, how to map this CPF field? My entity. @Entity public class Client { @Id @GeneratedValue(strategy =…
-
1
votes2
answers1055
viewsJPA spring boot custom data does not work
public interface ProdutoRepositorio extends JpaRepository<Produto, Long> { @Query(value="SELECT new br.com.thiago.objcustom.SomaDosProdutos(e.nome, sum(preco)) FROM sitethiagodois.produto p…
-
1
votes2
answers112
viewsjava.lang.String cannot be cast to com.sisEnade.tcc.modelo.Questao
good afternoon. I have the following error: java.lang.String cannot be cast to com.sisEnade.tcc.modelo.Questao However, I was unable to resolve the error. The goal of the implementation is to create…
-
1
votes1
answer761
viewsError saving related entities - Unsave Transient instance
A subsidiary owns a product - relationship @OneToOne - and one product has several historical. Method of registering implemented: public class CadastroProdutoService implements Serializable {…
-
1
votes2
answers187
viewsjavax.servlet.Servletexception: java.lang.Exceptionininitializererro
I’m trying to create my first project using JPA, using Jboss 5, Oracle, Hibernate and primefaces. After deploying the project I try to create and insert a new client into the bank through the web…
-
1
votes1
answer312
viewsShow sql generated by JPA/Hibernate
Is there any way to show SQL generated by JPA/Hibernate without enabling the property <property name="hibernate.show_sql" value="true"/>? The difficulty is that I need to monitor only one…
-
1
votes1
answer72
viewsHow to view Questions recovered from a DAO on the same JSF page
good afternoon. I have a page called simulated.xhtml in which I receive some parameters (Filter) to make a query in the database according to the filter. Everything is already working, what I wanted…
-
1
votes1
answer73
viewsTables not being generated - Hibernate
I have 2 tables of my software that are not being generated correctly. SQL is generated, but when checking in Mysql, not the encounters. If I change the tag to: <property…
-
1
votes1
answer205
viewsError making a GET, Javascript, Angular, Spring, Java request
I have an error opening the screen with the bank search results. error is in image below. Debugging, the data is coming from the database. In the other image, the server log appears My class…
-
1
votes0
answers496
viewsjavax.faces.el.Evaluationexception: java.lang.Nullpointerexception
You guys are my last salvation. I get this mistake javax.faces.el.EvaluationException: java.lang.NullPointerException when I try to register a client. My experience with development is low, I am…
-
1
votes3
answers514
viewsError persisting data in JPA
I am following algaworks exercises of the java-ee-7-com-jfs-primefaces-e-cdi-2a-edition module. When registering release I have the following error: WARNING: #{cadastroLancamentoBean.salvar}:…
-
1
votes1
answer165
viewsError when viewing postgres table using Jpa, Hibernate and Postgres
I did a small project to test a small registration in a postgres table , using jpa, with Hibernate, I managed to make the registration class work, it inserts in the table without problems but I…
-
1
votes0
answers43
viewsNullpointexception using JSTL
Hello. Guys, I’m having a problem trying to pull up a list of users using a c:foreach. When requesting the list, a Nullpointexception is returned, which, although I understand the reason for the…
-
1
votes0
answers81
viewsJSF and JPA with Eclipselink: Inserting element twice in the database
I’m working on software and I’m having a certain headache to insert some related objects. It is inserting this object twice and the error is not viewable. To see the whole project, follow github…
-
1
votes0
answers225
viewsChange JPA/JPQL record
I am doing my first WEB project and I have a question about using JPA/JPQL/MERGE. The doubt is as follows: I need to change a record of a table, I created a datatable that returns to me a list of…
-
1
votes1
answer467
viewsPersist JPA object array
I’m trying to persist a ArrayList of Entity in JPA with the following for: EntityManagerFactory emf = Persistence.createEntityManagerFactory("PU"); EntityManager em = emf.createEntityManager();…
-
1
votes1
answer1618
viewsjava.lang.Classnotfoundexception: Could not load requested class : com.mysql.jdbc.Driver
I have a Dynamic Web Project in Eclipse and have been constantly receiving this error: java.lang.Classnotfoundexception: Could not load requested class : com.mysql.jdbc.Driver. My persistence.xml…
-
1
votes0
answers76
viewsBoolean component and rendered components do not appear on my page
You guys! Good morning! I’m having a hard time here with JSF (it has to be this technology, because it’s the one I’m currently studying at home) I’m having trouble setting boolean component values…
-
1
votes0
answers32
viewsPrimefaces datascroller only loads once with Lazy
Guys, I started using dataScroller today with Lazy of the first faces <p:dataScroller ajax="true" id="listaDiarios" chunkSize="3" lazy="true" styleClass='ui-datagrid-no-border'…
-
1
votes1
answer46
viewsRemove objects that are attached to the list of others
I have a problem removing an object. What is happening: I have two tables -> PROCEDURE and SECTOR: I can create normal sectors, save, edit, delete and add procedures to the list of each created…
-
1
votes0
answers43
viewsUpdate child without deleting record using JPA
I have an entity that has a list inside it. That list is the same type as her entity. Ex: public class Aluno(){ List<Pessoa> responsaveis = CollectionsBuilder.createDefaultArrayList(); } When…
-
1
votes4
answers1245
viewsHibernate - How to search all rows of a table with Hibernate?
I am not able to find all rows of a table with Hibernate. Does anyone know the name of the method that does this?
-
1
votes1
answer521
viewsOnetomany mapping with HIBERNATE associative table - JPA
I need to do a hibernate mapping of a relationship 1:N in two tables, however there is an associative table that has as columns the ids of the other two tables. Example: The table Servicos may…
-
1
votes1
answer308
viewsProblem inserting object with Manytoone JPA
I will try to exemplify my problem with simpler classes than in my application: I have for example the Main class and an Item class. In Main, I have a property of type Item annotated with Manytoone,…