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
-
4
votes2
answers9897
viewsWhat is JPA’s mappedBy for?
Example: @OneToMany(mappedBy = "chemical", fetch = FetchType.LAZY) @LazyCollection(LazyCollectionOption.EXTRA) @JsonIgnore private List<SimulationChemicals> simulationChemicals; Why is the use…
-
4
votes1
answer724
viewsHow to map entity with Hibernate to create non-unique constraints?
I’m trying to create an entity with the following mapping: @Entity @IdClass(AutenticacaoPK.class) public class Autenticacao { @Id @OneToOne(cascade = CascadeType.REFRESH) @JoinColumn(name =…
-
4
votes1
answer1465
viewsJavase with CDI and JPA - Error WELD-001303
I am studying JPA and CDI in a Java SE application. When I will create the EntityManagerFactory I come across the error: Exception in thread "main" org.jboss.weld.context.ContextNotActiveException:…
-
4
votes1
answer1762
viewsHow to take the value bound to a selectOneRadio and assign it to an attribute in a bean
I request help to implement a method/way to take the value bound to a selectOneRadio (which is an Enum) and assign it to an attribute within a Bean. After obtaining the value linked to…
-
4
votes1
answer505
viewsJSF/Hibernate How do I save null to a database field?
I have an application using Primefaces/JPA-Hibernate/Tomcat8, and I need that when a field on the screen is empty, it will record null in the bank (Postgres). I need this because I have some fields…
-
4
votes1
answer524
viewsHibernate is not creating or updating BD tables
I have the classes Beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"…
-
4
votes1
answer84
viewsJPA does not reflect the changed data in the BD manually
I have a Javafx application with Hibernate (JPA). In this application I update a Tableview with the data I search from BD (Mysql). Every time I click for the system to search in the BD some data, it…
-
4
votes2
answers430
viewsCut bidirectional relationship looping
I am with a Spring project, using JPA and liquibase, I have a bi-directional relationship between two entities, I wonder if anyone has a solution to the problem of infinite referencing between the…
-
4
votes1
answer131
viewsForeign key recording as null
Foreign key is writing as null. I have done several searches I could not find a solution. Could help me find my error. This is an example that I searched on the internet, if I can popular the…
-
4
votes2
answers3140
viewsOnetoone JPA 2.2 Unidirectional Mapping
Hello, everybody. I am using JPA + Hibernate 4 above the database structure (Mysql 5.6) below. I am in doubt in the relationship @OneToOne. What’s going on: The entity BodyPart has a relationship…
-
4
votes2
answers253
viewsCheck and edit a List
I own a List: private List<Geracao> lista; This list will be filled with data from a database: lista = dao.findAll(); The method findAll() : @SuppressWarnings("unchecked") @Override public…
-
4
votes2
answers1673
viewsHow to resolve this 'java.lang.Illegalargumentexception: Unknown Entity' when running this simple application?
I am new to the world of Hibernate and when I run this application, I get the following exception: java.lang.IllegalArgumentException: Unknown entity: com.nataniel.api.domain.User at…
-
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…
-
4
votes1
answer48
viewsquery executes in the database but in the project points error
I have a query native: SELECT dist.nome Distrito, enti.nome Entidade, dist.id_distrito, dist.codigo_dne, dist.id_entidade, dist.id_municipio, dist.id_uf, dist.flag_ativo, muni.nome Municipio,…
-
4
votes1
answer193
viewsJPA ordered return from the Many side of an @Onetomany entity using @Orderby
I have the following entity Cliente who owns Pedidos. The relationship between customers and orders is mapped with Cliente @OneToMany and Pedidos @ManyToOne. What I need is for the Customer Order…
-
4
votes1
answer664
viewsCount with HQL JPA
Problem How do I receive the amount of record from a database table? public Integer quantidadeRegistros() { try { Query query = em.createQuery("SELECT COUNT(*) FROM Categoria cat"); return (Integer)…
-
4
votes1
answer461
viewsHow to versioning the REST API URI address?
I’m looking at ways to view the Uris from a REST Spring API because if they launch a new application, the REST API will meet the new application and support the old application requests for a…
-
3
votes2
answers1252
viewsJPA, Oracle and Exception Handling
I am using vraptor 4, JPA and Oracle. But when an exception occurs during persistence the error code that Oracle generates is not coming along with Exeption. This is the Repository @Repository…
-
3
votes1
answer1064
viewsI can’t connect Jpa to Postgresql at all
Good I’m trying to connect the postgresql, however, without success. My application will be an application jsf and so I’m using persistence. <?xml version="1.0" encoding="UTF-8"?>…
-
3
votes1
answer5577
viewsHow to change the default postgresql schema in persistence.xml in a java application
I am developing an application and I have a certain difficulty to change the default scheme of the application. I am using Postgresql in a Java application with JPA and Hibernate as implementation.…
-
3
votes2
answers551
viewsData source failed with JPA and Eclipselink
When I put for the persistence.xml use a JNDI Resource configured in Glassfish itself. But when it is to take from the file glassfish-resource.xml gives the following error: Information: [EL Info]:…
-
3
votes1
answer741
viewsUpdate all schemas with multitenancy architecture
Good morning. Next, I have a multitenancy application using Hibernate with JPA. We recently implemented the multitenancy architecture and persistence.xml was configured to automatically update the…
-
3
votes1
answer188
viewsFailed to use Spring MVC and Jparepository search field
Good afternoon. I’m working on Repository and Spring MVC. I have an interface, Storedao that looks like this. public interface StoreOrderDAO extends JpaRepository<StoreOrder, String>{…
-
3
votes2
answers1390
viewsjpa jpql filter without using the primeface filter (with proper method)
Changed to likely solution however is not working yet, it seems to me that the line is not updated with ajax. <h:body> <h:form id="formTableProd"> <ui:composition…
-
3
votes1
answer690
views -
3
votes1
answer1148
viewsHow to structure Hibernate Entity relationship annotations?
I would like to understand the difference between Hibernate annotations with JPA: @Onetoone, @Onetomany, @Manytomany and @Manytoone from Hibernate, how it works?
-
3
votes1
answer413
viewsTemporary table that Hibernate creates
I’m using JPA and Hibernate 4.3.11 when running a simple application To test the bank connection Firebird 2.5 the Hibernate is generating A temporary table with the start HT_. Example: created the…
-
3
votes1
answer1776
viewsUnit test/ Mock of a JPA query
Hello, how do I generate a unit/mock test of a JPA/Criteria query ? What can I guarantee by mocking my objects? Table structure? What should I mock? The consultation is very simple, only one select…
-
3
votes2
answers5194
viewsWhat is the purpose of the "persistence.xml" file?
I’m studying about the Hibernate, And along the way I came up with several doubts, one of my doubts, and that is important for my learning, is about the purpose of the archive persistence.xml which…
-
3
votes2
answers677
views -
3
votes1
answer3905
viewsHibernate - Uplicate key value violates Unique Constraint
I have the following problem: Person: @Entity @Table(name="tb_pessoa", schema="public") @Inheritance(strategy = InheritanceType.JOINED) public class Pessoa implements Serializable { private static…
-
3
votes1
answer417
viewsJPA error Hibernate = foreign key is returning null
After a long time of research, without success, I decided to post my doubt. I am using JPA/Hibernate and I have two tables: a Pessoa and another Funcionário. The error occurs when I save my data,…
-
3
votes1
answer203
viewsDuplicate mapping error: org.hibernate.Duplicatemappingexceptionn
I am using Hibernate 5 and am having the following problem: Caused by: org.hibernate.DuplicateMappingException: duplicate import: br.edu.unifeob.entidades.apuracao.Avaliacao refers to both…
-
3
votes1
answer166
viewsHow to map a column that does not exist in the bank?
I have a small problem when mapping (JPA) the columns of a class of my system. I have some procedures in bank that do a lot of things already and would not like to stop using them, but I do not know…
-
3
votes3
answers210
viewsHow to create tables when starting Sisitema with JSF and JPA?
Guys, how do I make sure that when the system starts the tables you are created automatically? The way my system is, tables are only created when some kind of access to the bank is done. For example…
-
3
votes3
answers143
viewsHow to enter records when starting the JSF+JPA system?
How do I insert pre-registered records into the system with jsf and jpa. I want when the system starts the admin user to be created.
-
3
votes1
answer226
viewsMapping an enumeration
I have a problem with Ibernate: When I try to give wakeup on the server, it gives me the following error message: Use of @Onetomany or @Manytomany Targeting an unmapped class. Saying that I am…
-
3
votes1
answer250
viewsPartial update of object / Do not update null values with JPA
I’m using JPA for a webservice, and I’m using the Merge to update, but it updates all values of my object, there is some way to perform a partial update of it ? Example, only change values that are…
-
3
votes1
answer397
viewsAnnotation @Manytomany in the same entity/table
My Class: @Entity public class Report extends AbstractModel implements IReport { @Column private String nome; @Column private byte[] arquivoJrxml; @ManyToMany private List<Report> subReports;…
-
3
votes0
answers156
viewsHow to implement Flyway in a Javaee Maven project with Hibernate, vRaptor and JPA?
In a project Maven, JPA, with Hibernate and vRaptor integrated, how to implement easily and effectively, the Flyway? Implementing this, my bank will update how it was in developing the <property…
-
3
votes1
answer935
viewsJPA/Primefaces - Add/Remove records from a daughter table
I have a problem in a cadastral panel. There is a register of store network in which I am taking care of the implementation. I can normally insert and remove items from the datatable, but this is…
-
3
votes2
answers762
viewsProblems to remove @Manytomany element with @Jointable
I’m having trouble deleting a @Manytomany relationship on JPA. In short, I have 3 tables: USER, PERMISSION and USUARIO_PERMISSAO which is the relationship of the previous ones, the relationship is N…
-
3
votes1
answer392
viewsJPA/Hibernate Entity with Collection for itself
Hello, I have an entity called menu in my system. A menu can be child of another menu and so on. The table has the following structure: The entity is mapped as follows: @Entity…
-
3
votes3
answers1706
viewsHibernate and JPA are the same thing?
It is a question of who just took this subject to study but confuses me a lot. I read some articles about ORM and did not understand very well what is one and what is the other, are the same thing?…
-
3
votes1
answer238
viewsHow to turn this query into a JPQL?
I have the following query in the postgres database: select * from trabalha_projeto tp inner join Empregado e on e.matricula = tp.empregado how it turns it into a JPQL query? I’m having a hard time…
-
3
votes2
answers452
viewsProblem with Entitymanager and JPA
I have a problem here that says the entitymanager is closed...I took a look at the net to follow the same model, but here’s wrong... this is my entitymanager method private EntityManager…
-
3
votes2
answers470
viewsProblems opening connection to JSF and JPA
There’s something wrong with mine persistence.xml? I can’t open the connection. My Bean is like this: import java.util.List; import javax.faces.bean.ManagedBean; import…
-
3
votes1
answer115
viewsProblems with Opensessioninviewer + JPA + Tomcat standard
Hello, I am using Tomcat + JPA + Vraptor 4 and I am using cdi to inject Entitymanager as follows. Entitymanagerfactorycreator: public class EntityManagerFactoryCreator { @ApplicationScoped @Produces…
-
3
votes1
answer384
views -
3
votes1
answer374
viewsHibernate, force table name in low box
I am using Hibernate 5.2.1.Final as an implementation to handle Mysql database. The problem is that the tables are being generated with the first letter in high box, would like to force to be all in…