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
answer210
viewsOperations in JPA
Good morning I am developing an application in which the user should inform the system a list of exams and the system display the laboratory units that perform such exams, however I am with a doubt…
-
1
votes0
answers177
viewsProblem with table generation (tutorial algaworks)
I’m reading the book Java EE 7, with JSF, primefaces and CDI. I got to the configuration part of Hibernate, but I’m having problems. I configured my application in a J2EE environment, with JSF and…
-
1
votes3
answers684
viewsCall database function that receives a list as parameter
People like me do the following... involves database (Postgres SQL) and JPA, I want to create a database function that receives a list of ids as parameter and make a query cm enclosure WHERE IN…
-
1
votes0
answers67
viewsProblem to update data
Good morning friends, I am about 3 days with difficulties in an error that has been occurring in my application. I have two entities, CUSTOMER and VEI. I did the mapping bidirectionally saying that…
-
1
votes1
answer167
viewsConfiguration error on JPA and Postgresql connection
I am having problems connecting JPA with Postgresql. I believe the problem is in the configuration of the application. I am using the Java 8 version, and my pom.xml file is: <project…
-
1
votes1
answer67
viewsPrecedence in Query JPA
I’m using the notation @Where(clause = "ts_removed is null") in my entity. If I insert a method with @Query(value = "XXX") in my repository, the query will overwrite or use my Where clause inserted…
-
1
votes2
answers601
viewsUnable to build Entity manager Factory ( Hibernate JPA )
I am trying to make a connection with Hibernate and JPA, but when trying to create the connection or persist some data it executes the following error: Dec 04, 2018 2:02:45 pm…
-
1
votes2
answers80
viewsHow to Recover Data from a Datepicket Add to Mysql/JPA Database
I am trying to recover the data from a Datepicker in JAVAFX and put in my database, but I cannot convert in a certain way :( // Desse modo dá certo String cpf = cadastro_alunoCPF.getText();…
-
1
votes1
answer31
viewsDifferent web applications use the same connection pool
Hello! I have two Webs applications that are connected to a single database in the bank, how do I make them enjoy the same connection pool? I create the c3p0 variables in the persistence.xml of…
-
1
votes0
answers217
viewsHow to close connection like Jparepository and Spring Boot
Hello, I am working on a project using Spring Boot and am using Jparepository. I need to close the connection after running a bank operation, for example: query - findAll(). I know it may seem…
-
1
votes0
answers558
viewsHow to query involving more than one table (JPA) using JPQL
Hello, I have a query using SQL, now I am changing the project using JPA and I would like to change the queries in a coherent way with JPA. public void gerarConsulta() {…
-
1
votes1
answer177
viewsMaven Spring MVC + JPA Project
I’m new to Spring MVC, created an example Maven project for Spring MVC using Hibernate and JPA. I found some problems when configuring persistence.xml but I could not use dartasource managed by…
-
1
votes1
answer281
viewsI can’t save in the bank and does not show error log in Hibernate project
In the project I use hibernate, and when I try to save a new client, it just shows the class validation message CadastroClienteService. The strange thing is that all fields are filled in the form,…
-
1
votes1
answer398
viewsInjection error of a JPA object in the Managerbean web project
I am having an injection error of a JPA object in Managerbean in the web project. I have divided into two projects controlled by the Maven. In the first project called Perolamodel contain the…
-
1
votes1
answer19
viewsError trying to use AVG in @query Spring
When trying to perform a query to return the average score with spring null error appears. When I test without avg(a.note) it returns the data correctly. @Query(value = "select new…
-
1
votes1
answer819
viewsHow to make a basic configuration in the persistence.xml file to access a database in SQL Server 2008?
I searched about how to set up the file persistence.xml in a basic way, however, I was even more confused about this configuration. So I would like to know how I can make a basic configuration in…
-
1
votes0
answers251
viewsVarious databases accessed at the same time JPA
Today I have the following scenario: my customers enter my site and appears the login screen, where I ask the User Group, Login and Password. For the Group I have a database, where it has the data…
-
1
votes0
answers1551
viewsUse SELECT NEW JPQL to popular DTO in a @Onetomany relationship
Talk to the guys! I am trying to popular my DTO object, whose main object has a Onetomany relationship. Follow the code for vcs observations: ## Mapped Object: public class Usuario implements…
-
1
votes1
answer200
viewsImprovements to Entitymanegedfactory JPA
Staff I am working as follows , I have 2 PersistenceUnit , one from the Manager’s database , which is where I find the data from the clients' databases ,another from the clients' database , which I…
-
1
votes0
answers92
viewsPersisisntece.xml configuration with Glassfish datasource
Next people I made 2 glassfish datasources!!!! Where the first is a fixed database!!! Follow picture: This datasource is working correctly !!! My second I do not pass the Database property because…
-
1
votes1
answer95
viewsUsing CDI in the app
People have a problem , on my login screen I can inject the in a good, when I step to the second screen that would be the Dash , I can not inject , he only brings me with null .... Segue Conexao :…
-
1
votes1
answer81
viewsError with Hibernate when running server
When running wildfly I have the following error snippet in the log: 15:46:18,297 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service…
-
1
votes1
answer281
viewsDelete created entity from a Manytomany relation
I have a relationship ManyToMany amid users and profiles mapped with Hibernate: user: id name profile: id profile_name user_profile: user_id profile_id The mapping is done as follows: User:…
-
1
votes1
answer181
viewsJasper Studio with Hibernate Session
I’m trying to add a connection in Jasper Studio via the option "Hibernate Session" I added the . Hibernate jars, the Mysql Driver and I’ve uploaded the Hibernate.cfg.xml file, but still, I always…
-
1
votes1
answer477
viewsError: Entitymanager is closed
My command system, when trying to merge tables, I use Entitymanager.merge, but the following error occurs: Entitymanager is closed. Follows one of the functions of my code that occurs this error:…
-
1
votes1
answer39
viewsProblem with controlling connections with the Bank
I am having some problems connecting to the database. Follow my code and the exception. Code @Repository public class MinhaClasseDAOImpl implements MinhaClasseDAO{ protected EntityManagerFactory…
-
1
votes1
answer133
viewsI cannot download Hibernate and mysql dependencies #Algaworks
I’m following the playbook algaworks-ebook-java-ee-7-com-jsf-primefaces-e-cdi-2a-edicao-20150228 and in the financial project to put the dependencies of the hibenate and mysql in the pom xml I can’t…
-
1
votes0
answers96
viewsJpaupdateclause with Join
I have the following entities: @Entity @Getter @Setter @NoArgsConstructor @Table(schema = "MYDB", name = "TB_TESTE") public class Teste implements Serializable { @ManyToOne @JoinColumn(name =…
-
1
votes1
answer365
viewsHow to read properties file to configure JPA?
I have a file . properties to configure my project’s database. However, I cannot read the file. Someone gives a force? Entitymanagerproducer @ApplicationScoped public class EntityManagerProducer {…
-
1
votes2
answers703
viewsHow to return the entity number of a table using JPA and the COUNT function?
I am using the Eclipselink implementation and cannot solve the following query that must be wrong: Query query = em.createQuery("SELECT e , COUNT(*) FROM Empregado e"); Integer resultado = (Integer)…
-
1
votes1
answer131
viewsMultiple @Elementcollection in two different classes @Embeddable
I have an entity with two classes Embedded of the same kind and each has a Elementcollection same type, too. Business logic seems to be correct, but I’m experiencing some problems with the lack of…
-
1
votes1
answer77
viewsSensitive data in persistence.xml
I am using JPA in my application and so I have a file persistence.xml which contains the connection data to my database: <property name="javax.persistence.jdbc.url"…
-
1
votes2
answers1888
viewsError :"Cannot create JDBC driver of class '' for connect URL 'null' java.sql.Sqlexception: No suitable driver"
Hello, I am trying to configure the database connection in my JPA application using JNDI. I am following this tutorial…
-
1
votes2
answers224
viewsWhy does Hibernate not list results if the select query calls table null field?
I have a Product Entity-Class. @Entity public class Produto implements Serializable{ @Id @GeneratedValue private long id; @Column(length = 70, nullable = false) private String cod; @Column(length =…
-
1
votes0
answers214
viewsProblem when a relationship persists
I have 2 entities, the Submodel has a list of possible Options. I made a unidirectional Onetomany relation, when I make any persistence in the entity Submodel that the list of Options this empty the…
-
1
votes3
answers813
viewsHow to find Session in Hibernate 5.2.3.Final
hello! Guys I’m changing my Hibernate from version 4.3.8.Final to 5.2.3.Final. Now I’m not getting the Hibernate Session like I used to, like this: (Session) manager.unwrap(Session.class); Gives…
-
1
votes1
answer55
viewsJPA in java web
I am with a JAVA WEB project and I am having problems with Hibernate. The error is as follows: Informações: HCANN000001: Hibernate Commons Annotations {4.0.2.Final} Informações: HHH000412: Hibernate…
-
1
votes1
answer81
viewsRemove default message @Pattern JPA
I need a help from you. I am creating a web service in java using jersey and Ibernate. To validate the fields informed by who calls the service I used for one of the fields the JPA @Pattern…
-
1
votes2
answers380
viewsIntegration between Spring MVC and JPA
I’m trying to integrate the Spring with JPA but so far I have not had success in this configuration. One of the doubts is whether I can configure the bank through the spring-context.xml. Follow the…
-
1
votes1
answer346
viewsHibernate does not update information
My problem if it comes to an update unsuccessfully follows the code below. EntityManager manager=JpaUtil.getEntityManager(); EntityTransaction trx= manager.getTransaction(); trx.begin();…
-
1
votes1
answer422
viewsHibernate/JPA - Object is an Unsaved Transient instance
Good afternoon people! When saving a new contract adjustment I have to research other contracts "similar" to what I’m readjusting and readjusting them as well. For that I was trying to use a…
-
1
votes1
answer228
viewsConstraint error while trying to persist with Cascade
Good morning, I have the following problem Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: não é possível inserir NULL em ("XXGOVC"."ASSINATURA"."ID_DIRETRIZ") And here is…
-
1
votes1
answer86
viewsCharacter difference enconding Charset Difference using JPA but not with Prepared statement
I have an application using spring boot + oracle (via Tomcat datasource). Using spring-data, a simple query in a table returns encoding problem characters. This same application, in a very specific…
-
1
votes1
answer231
viewsEclipselink and JPA
I have problems trying to record information in the database, in a simple WS with JPA, Eclipselink and Postgresql database. I can search data and present them as json in the browser with GET…
-
1
votes1
answer447
viewsHierarchical selects. Parent-child relationship in the same table
I have a Product Entity regarding @Manytoone. And I need to bring the last child record of each parent. I made a select in the table and this bringing what I need more I’m not right to do the same…
-
1
votes0
answers73
viewsIncorrect date/time format
In my next code snippet: String horario = evento.getDataOcorrencia().concat(" ").concat(evento.getHoraOcorrencia()); horario = horario.replaceAll("/", "-"); SimpleDateFormat dateFormat = new…
-
1
votes1
answer65
viewsProblem to recover data using Hibernate
I can list the Customer and their Animals, but I can’t list the Animal Breeds. Follows the involved relationship classes: Client class @Entity public class Cliente extends Pessoa {…
-
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
votes2
answers47
viewsError to popular array with Double
I need to put in a array of double the quantity field data coming from the database. By doing this with the following code: static List<Historico> listaComCincoUltimosMeses = new…
-
1
votes0
answers80
viewsDisplay database image in datatable
I saved an image in the database and want to display in dataTable PS: I know that it is not good practice to store image within the database, this practice was done for study purposes. <h:form…