Most voted "jpa-2.0" questions
Java Persistence API (or simply JPA) is a standard Java language API for data persistence that must be implemented by frameworks that wish to follow such a standard. JPA defines an object-relational mapping medium for simple and common Java objects (Pojos), called entity Beans. Several object/relational mapping frameworks such as Hibernate implement JPA.
Learn more…103 questions
Sort by count of
-
13
votes2
answers13163
viewsHow to make the Genericdao class using Hibernate?
I wanted to know how to make a generic Dao of a project, using Hibernate and JPA in java. All this to not be mounting a DAO as follows for each object that will persist in the bank: public class…
-
11
votes2
answers2459
viewsCriteria API - Hibernate vs JPA 2
I will try to phrase this question in the least opinionated way possible in the spirit of stackoverflow in English. For a new project I need to make the decision between using the JPA 2 or Hibernate…
-
11
votes1
answer18212
viewsWhat are the types of Scade in JPA?
I’m looking for information on the types of Scade that exist and how they work in JPA relational modeling. The guys I found explanations for were: NONE = Does nothing with the object (default) MERGE…
-
6
votes2
answers13323
viewsEntitymanager.merge() persisting instead of updating
Update method: public void update(T u) { EntityManagerFactory f = Persistence.createEntityManagerFactory("crud"); EntityManager em = f.createEntityManager(); em.getTransaction().begin();…
-
6
votes1
answer624
viewsUnique key violated when I’m doing a delete. Why?
I have a problem that seems silly but I’m skating and I can’t solve it. I have a nice application made in Java using JPA 2 with Spring, Spring Data, JSF, etc... It works great. The basis I’m using…
-
6
votes1
answer1120
viewsHow to prevent the List.size() method from running lazyload with Hibernate and JPA
When I make a query in the bank and an object is returned, in this object has a collection, which by default is Lazyload, if I do object.getColecao().size() ai is run the lazyload to bring the…
-
6
votes2
answers1478
views -
5
votes2
answers350
viewsFetchtype.EAGER for Fetchtype.LAZY
I have the following problem, the whole system uses a relation, Eager, but for a specific query I do not want to bring all relations in the bank, because it would be too heavy the process, only for…
-
5
votes2
answers572
viewsPrimarykey, Foreignkey and Unique With JPA
I have the following situation: Student Entity (id and other) Entity Evaluation (id and others) Entity Notaavaliacaoaluno (avaliacaoId, alunoId) I want to transform the attributes valuedId, alunoId…
-
5
votes2
answers1286
viewsMultiple Persistence Units with Spring Data
You can create multiple Units persistences by connecting to separate databases in the same JPA application using Spring Data? For example. I have an application that will run in Mysql normally.…
-
5
votes1
answer393
viewsJPA - Registry error not found right after insertion
A question about JPA procedures, because of a mistake that happened and I’m not getting it. I’m taking care of a part of the system that feeds a card order table. It searches if the user that the…
-
5
votes1
answer372
viewsData modeling via JPA and Hibernate
I’m doing a project with JPA regarding a quotation system and I’m having doubts on how to build the relationship between classes, and would like (if possible) some opinions. My project is a quote…
-
5
votes1
answer201
views -
5
votes1
answer1147
viewsHow to query in Manytomany tables?
I have two tables/entities in the database with the following attributes: Car (code, plate, color) Acessorio (code, description). public Carro buscarCarroComAcessorio(Long codigo) { return (Carro)…
-
4
votes2
answers4977
viewsUsing the JPA repository
Last Saturday I presented my TCC in college and saw that I need to improve the presented project. The system receives tax notes in format XML and manipulates them. I based the system on the company…
-
4
votes1
answer462
viewsHow to test the service layer
I’m developing a multi-layered, multi-module web project. For the persistence layer I am using JPA 2.1 and Hibernate 4.2 and for Junit 4 tests. In this architecture my project was divided into…
-
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
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…
-
3
votes2
answers599
viewsHow to make Hibernate "realize" that the value of a column was set by the database
My table in the database has a column that is automatically populated by the database itself. This table is mapped as an annotated class with @Entity, called EntidadeA. The column that is…
-
3
votes1
answer238
viewsHow to play query with Mysql queries in Hibernate?
I am using JPA 2.0 and trying to play this query in Hibernate , but I am not able to visualize how to do. I did it in Mysql language SELECT totalassociado, totalcriticado, items.item_codigo_item,…
-
3
votes1
answer359
viewsSlow search for Hibernate Search index
That’s a crosspost that I did in the stackoverflow in English. It is difficult to understand (and correct) this problem. I’ll put it here to see if anyone in our community has been through this and…
-
2
votes3
answers1547
viewsSave same object multiple times
Solution: setar id = null Code saved 10 times if running on the Tomcat server, but running on Glassfish only adds once. <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0"…
-
2
votes1
answer216
viewsClear Target on JSF+JPA+Richfaces projects
How can I clear the Targets generated from the project when we deploy for Jboss?
-
2
votes1
answer63
viewsClass relationship by collections in JPA2
In a bean that has a Onetomany connection, with others, through a Hashmap that annotations should be used?. @Entity class Rodada{ public HashMap<Pergunta,Resposta> perguntas;…
-
2
votes1
answer1217
viewsSpring Bean sessionFactory with Nullpointerexception error
Good morning. I am trying to make a configuration in the spring-jpa.xml file to support a multitenancy architecture separating each client by Schema. I use a datasource that has been configured in…
hibernate spring jpa-2.0 wildfly multi-tenancyasked 9 years, 7 months ago Giancarlo Abel Giulian 3,999 -
2
votes2
answers865
viewsI can’t save to the database in a Spring MVC project
I will explain the project because I believe that most people usually create projects using XML, and I created the Spring MVC project by dispensing the files that configure the project as XML. The…
-
2
votes1
answer831
viewsSubquery in the select clause with JPA Criteria
I was searching how to do a subquery in the select clause with Criteria of a select of this type: SELECT tabela1.*,tabela2.*, (SELECT MAX(tabela5.AtrDatatabela5) FROM .Tabela3 AS tabela3 INNER JOIN…
-
2
votes1
answer402
viewsStackoverflowerror exception occurring in @Manytomany relationship with JPA
I’m having a problem in an entity relationship @Manytomany. When I try to make a simple query in the entity that contains @Manytomany a stackoverflow occurs. My rule is simple: My…
-
2
votes0
answers160
viewsJPA(Hibernate) update entities automatically
I have the following question: I realized that when using JPA (Hibernate) + Spring in a JSF (Primefaces) application my entities are not updated immediately when performing a registration, for…
-
2
votes1
answer774
viewsJPA/Hibernate problem with competition and persistence in the JRE
I am working on a project to create a simple server running over Java SE. I am using JPA + Hibernate to perform persistence, but competing routines are a problem. I am spending a lot of time trying…
-
2
votes0
answers218
viewsMicroservices + JPA Entities
I have two REST services (separate projects) responding to the following entities with JPA (@Entity) mapping and each with its own database. Product(ID and TITLE) and Category (ID and TITLE) I found…
-
2
votes1
answer785
viewsComposite key problems in JPA
Hi, I’m a little young with JPA and I’m having problems with a composite PK. Follows the class Aluno: @Entity @Table(name = "Aluno") public class Aluno { @Id private String ra; @Column(length = 50,…
-
2
votes1
answer689
viewsJPA does not persist the Object in the database
I have a problem in which I try to persist data in the Database with JPA and Hibernate only that it does not persist the Object. It creates the table but does not persist the data and no exception…
-
2
votes0
answers74
viewsJpa/Hibernate causing connection Leak
I have a large project with several classes.There is a connection Leak, every time I make a request, it creates connections coming an hour to hang because of the max of the connection pool. Pojo…
-
2
votes2
answers2446
viewsSelect JPA and Hibernate
I have five entities (Quotation, Sector, Partner, Items and Items), where the user will select a quotation and sector and the list of all items related to this sector will appear, along with the…
-
2
votes1
answer111
viewsWhy doesn’t Entitymanager have the createQuery method with typed return?
I am following the project of the book Spring-MVC of Casa Do Código, using the latest version of Hibernate, a 4.0.3. But in a moment, when the book indicated the creation of a typed query through…
-
2
votes1
answer485
viewsCreate JPA project without persistence.xml?
I created a project with Swing and JPA and is working well, now I want to remove the file persistence.xml and create a class for him to work in his place. I’m researching some way to do this and I…
-
2
votes2
answers198
viewsHow do select in specific columns and continue to receive an entity list and not an Object array?
Having the second class: public class Usuario { private Integer id; private Email email; private String nome; private String sobrenome; private String senha; private String usuario; private…
-
1
votes2
answers1966
viewsReturn of select objects (Combobox) with Hibernate + JSP + Vraptor. Does not fill relationship between tables
I have an object TabelaPrecoItem with all the structure formed and almost everything working, follows the model of the model. @Entity @Table(name = "fov_tabela_preco_itens") public class…
-
1
votes2
answers122
viewsChanges directly in the database reflect in the bean Managed?
I’m developing a simple web application, a form. I did the DAO’s, Facades and they are working correctly (at least I think they are) but I will also need to edit some values directly in the bank…
-
1
votes0
answers118
viewsHibernate + Maven + Glassfish
I have a Maven Project, which uses Hibernate, and has all the dependencies ok. I’ve already created the connection pool in glassfish. The problem is that even the class mapped with the annotations…
-
1
votes1
answer587
viewsJSF agenda with datatable containing data from different lists
I am making a software in JSF (2.2), primefaces and JPA with the Postgres bank. I need to make a schedule of accounts to pay with the following columns and their data: Column before yesterday with…
-
1
votes1
answer82
viewsError regarding the number of parameters in Query when not using Query, what is wrong?
I’m having difficulty using Hiberante/JPA with composite key, I believe the problem is there, although the generated exception stacktrace points to another place that is not superficially related to…
-
1
votes1
answer486
viewsHow do I make a Onetomany Unidirectional relationship with joincolumn mandatory?
How do I make this relationship mandatory when the in persist.() be executed? I don’t want to map bidirectional. @OneToMany(cascade = {CascadeType.ALL}) @JoinColumn(name =…
-
1
votes1
answer314
viewsMapping the same entity class to two banks
Good afternoon Earthlings, I am a beginner in java and I have the following situation. I have two databases, where I will transfer the records from one database to the other. There is the…
-
1
votes3
answers3382
views -
1
votes1
answer29
viewsSpring + Hibernate
Good morning! I’m studying Spring MVC, Maven and Hibernate. In the structure of the project created with Maven, where I put the file applicationContext.xml ? Thank you.
-
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
votes1
answer216
viewsJpa does not create column @lob
I’m mapping a field @lob to save image to a table, but jpa creates the table, but does not create the column. I created the column manually in MYSQL, but then the bytes do not persist either. My…
-
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 =…