Most voted "hibernate" questions
Hibernate is a framework for object-relational mapping written in the Java language, but is also available in . Net as the name Nhibernate.
Learn more…934 questions
Sort by count of
-
15
votes1
answer27253
viewsDifferences @Onetomany, @Manytomany, @Manytoone, @Onetoone
I wanted to build a database with Java Hibernate as below: Doubts: What’s the difference between @OneToMany, @ManyToMany, @ManyToOne, @OneToOne? And what would your statement look like in Java?…
-
14
votes1
answer1567
viewsUse the same entity in Hibernate to write to two tables
I am using Hibernate to make the persistence in the database, and in a given case, for each update that a certain entity Consultor has, it must update in the main table called TB_Consultorand insert…
-
14
votes4
answers1204
viewsSpecific use of Try-catch
I am studying Hibernate and with it came some doubts that have come to me before but I did not question in depth. public void salvar(Usuario usuario){ Session sessao = null; Transaction transacao =…
-
13
votes2
answers1652
viewsHow to perform TDD on the Service layer
I participate in a project that uses MVC layers with Hibernate framework persisting in a Postgres. Junit is used for testing and Mockito is used for mocking (I still have no knowledge and practice…
-
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…
-
12
votes1
answer1008
viewsProblems with JSF Fileupload
I am able to save the disk image in this JSF project <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"…
-
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…
-
10
votes2
answers341
viewsError updating the entire JAVA table
I’m trying to perform a mass update to update all prices of products registered in the system, adding the value passed by the user to the unit price of the registered product, according to the…
-
9
votes2
answers3664
viewsConnection to the Bank drops after a certain time
I have a server where I have several web applications connected to the database(Mysql). The problem is that if any system gets idle it loses the connection to the bank and I have to refresh the…
-
9
votes4
answers11232
viewsJPA Object References an Unsaved Transient instance - save the Transient instance before Flushing :
When trying to save the "Addresses" of "Client" JPA/Spring returns me the following error in "main" Caused by: org.hibernate.Transientpropertyvalueexception: Object References an Unsaved Transient…
-
8
votes1
answer6420
viewsApache Tomcat (Production Setup)
Good morning, I’m doing a project and using Tomcat 8 as my server. The point is, I have a Linux server to host my application, but I would like to know if I need to do any different configuration…
-
8
votes2
answers2937
viewsBest Way to Use and Instantiate Entitymanagerfactory
My project has the following structure: Within the package br.mandacaru.DAO are the controllers. To instantiate an object JPAController I need an object EntityManagerFactory and for that reason I…
-
8
votes3
answers1408
viewsWorking with JPA+Hibernate cache
I doubt how I should work with the objects EntityManagerFactory and EntityManager. Currently I urge a EntityManagerFactory for the whole system, since I have only one bank, I create only one and use…
-
7
votes1
answer5553
viewsjava.lang.Illegalargumentexception error in Hibernate when working with Enum
Take a look at the error message: jun 02, 2015 5:23:57 PM com.sun.faces.lifecycle.ApplyRequestValuesPhase execute ADVERTÊNCIA: /WEB-INF/template/pedidos/CapaPedido.xhtml @29,99…
-
7
votes2
answers1104
viewsDoubt how to configure Spring Data with Hibernate
How to set up Spring Data + Hibernate Hello everyone, I’m new here in stackoverflow and also in java web development. I am etudando some things of Spring Frameork and I am with a doubt of how I can…
-
7
votes1
answer2978
viewsPagination with large amount of data
Thinking about performance, what is the best way to paginate a large amount of data? I’m currently wearing a List<Produtos>, keeping around 500 products in it, and using subList(min,max),…
-
7
votes1
answer297
viewsMulti Tenancy with Hibernate update schema
Hello I am with an application that uses multiple databases (multi-tenancy) using Hibernate. I wonder if anyone knows any way Hibernate can update the bank schema. I’ve already set the property…
-
7
votes2
answers1171
viewsEntitymanager or Session? What to use?
I have worked with projects that used both Session and Entitymanager but it was never clear which one to choose. On what basis they differ in terms of performance and compatibility. Someone can give…
-
7
votes2
answers739
viewsProblems with Hibernate Lazy
Friends, all good? I have a problem that is the famous: org.hibernate.Lazyinitializationexception:. I know this is because the session has been closed and Hibernate can’t connect to make the selects…
-
7
votes1
answer239
viewsWhat is the difference between method annotation and attribute annotation
Guys, I started learning and using the hibernate recently, and while searching for answers to my questions regarding the annotations I have come across following occasions: 1st) The attribute has…
-
7
votes1
answer2011
viewsCascadetype.ALL doesn’t work. Am I using it wrong?
In my code, I have the classes Author and Book, with the relationship Many To One, as below: Java author. import javax.persistence.CascadeType; import javax.persistence.Column; import…
-
7
votes1
answer5651
viewsInfinite recursion (Stackoverflowerror): Error when listing products with categories and unit of measures
Good afternoon! I am trying to list the registered products, but the error happens below: Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not…
-
7
votes1
answer99
viewsPersistent Hibernate Resource Return
Good afternoon. I would like to understand how to resolve the following issue: In the project I’m working on, Backend and Frontend are separated. To persist the data I am using Hibernate and to…
-
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
answer235
viewsPopular via builder with Hibernate
I was reading this article http://blog.caelum.com.br/nao-aprender-oo-getters-e-setters/ and talks about using constructors to popular objects and set aside some setters. How can I use constructors…
-
6
votes2
answers1032
viewsGenerate sequential java number with Hibernate
Is there any way using Hibernate generate a custom number to be the identification number of a particular record? I have a system that stores care performed to a patient, every time a new care is…
-
6
votes4
answers11643
viewsError while running Hibernate
After catching a little, I’m walking with my project. When running the project, I have the following error: mai 16, 2016 6:41:22 PM org.hibernate.jpa.internal.util.LogHelper…
-
6
votes1
answer323
viewsJPA, Hibernate, Spring MVC, Maven - Definition
I’m having a lot of questions about definitions! My goal is to build a system architecture, but the definitions of JPA, HIBERNATE, SPRING MVC, MAVEN, are obscure. JPA: It is nothing more than a…
-
6
votes1
answer106
viewsHow to implement a "one to zero" mapping?
The scenario is as follows: A user may have many or no comments in the newsletters posted on a system - obviously, a comment belongs to a single user. The problem is that Hibernate does not have any…
-
6
votes2
answers942
viewsProperly configured hibernate does not insert into database
My code does not enter in the database Mysql. It identifies all database, tables and fields, but insertion is not done. Usuariodao.java package br.com.sistec.dao; import org.hibernate.Session;…
-
6
votes1
answer801
viewsAccess database in Openshift
I deployed a project on OpenShift, I used a Cartridge to create a bank Mysql soon after the creation of the bank appear this information: Mysql 5.5 database Added. Please make note of These…
-
6
votes2
answers4147
viewsWhat is the difference between Embeddedid and Idclass in Hibernate?
I have read in the Hibernate 5.0 documentation that you can implement composite primary keys using two ways. The first of these is using the annotation @IdClass and imitating the Idclass attributes…
-
6
votes2
answers1536
viewsFormat Date Return with Date and Non-string Format
I’m trying to return a date that is recorded right in the bank (1986-04-30 17:02:00), I try to convert this date to appear only "30/04/1986", but no use. The most I can get back is Wed Apr 30…
-
6
votes2
answers387
viewsHow to do concurrency control in Hibernate for INSERT in the database
I’m having a competition control problem in entering data in my web application. Context: I have 3 tables (ex: X, Y and Z) that record hospitalizations of patients (already registered). A patient…
-
5
votes1
answer154
viewsGetting Factory null in spring sessionfactory with configured resource
The name of the class containing the SessionFactory is DataProvider and has the following implementation: @Resource(name="sessionFactory") protected SessionFactory factory; protected Class<E>…
-
5
votes1
answer961
viewsCustom auto increment
I have to generate an auto increment of the type "000"+id, but I can not get to something concrete, my base is this below, I wanted only a light even of how to do, I do not need the answer itself.…
-
5
votes1
answer576
viewsHow/When to Close Hibernate Session?
I have an error after closing Hibernate Session public String listarTodosClientes() { session.getTransaction().begin(); List<Cliente> lista = session.createCriteria(Cliente.class).list();…
-
5
votes1
answer2052
viewsUsing Hibernate to generate tables with H2
I’m developing an application in which I decided to use H2 as an embedded database. It is the first time that I am using this type of database and I am having problems to generate the tables by…
-
5
votes1
answer588
viewsDifferences between Criteria and HQL
In the booklets I read and tutorials I accompanied the Criteria is more used, but I identified more with HQL. But I have the following doubt, all that is done with Criteria it is possible to do with…
-
5
votes1
answer606
viewsHow to configure Apache Log4j to write to the Bank through Hibernate?
I am starting to use Log4j from Apache and would like to know how to configure it by XML file to record the logs in the database using Hibernate?
-
5
votes2
answers18970
viewsHow does Hibernate.hbm2ddl.auto work?
What values can I use on this property? ex: Update <prop key="hibernate.hbm2ddl.auto">update</prop> How does it work? When should I use? is good practice?…
-
5
votes2
answers138
viewsIs hibernate considered white box or black box?
From what I understand the frameworks, Black box are known for their ease of use as it is not necessary to understand what is happening inside of it to use, and the white box otherwise, a knowledge…
-
5
votes3
answers1598
viewsHibernate vs Eclipselink
Both persistence frameworks implement JPA. 1 - There is a difference between the two? 2 - Which is the best in performance? 3 - As the two implement the same specification, after developing a…
-
5
votes1
answer446
viewsMonitoring Mysql database c/ Java application
I have a Java desktop c/DB Mysql application running in 100 company branches for more than 6 years. Today at headquarters we need some information from the branch database. I am developing a web…
-
5
votes1
answer374
viewsIn Hibernate, whenever I change the Entity configuration, do I have to drop the tables in the database?
Example: I have the Person class below: @Entity public class Pessoa { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long idPessoa; private String nome; //getters e setters }…
hibernateasked 9 years, 4 months ago Tiago Ferezin 1,567 -
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
answer1324
viewsjava.lang.Classnotfoundexception error: "Caused by: java.lang.Classnotfoundexception: com.fasterxml.Jackson.core.type.Typereference
I am developing a Java, FX, Hibernate application and using log4j2 for my logs. When I run the application through the IDE (Eclipse) everything works normally, but when creating the . application…
-
5
votes0
answers263
viewsCreate Tables with Hibernate
Good afternoon !! I’m new with Hibernate and I’m two days trying to implement the creation of tables with it, I’ve already followed several tutorials, but it doesn’t work. Can someone help me ?…
-
5
votes1
answer813
viewscannot be cast to java.util.Map
The method below that I created in the model layer, is returning me the error "cannot be cast to java.util.Map" public List<NotaFiscalProduto> listaItens (boolean entSaid, Date dtinicio, Date…
-
5
votes1
answer705
views"No Persistence Provider for Entitymanager" for Hibernate 5.x
Well, you have to update the version of hibernate that was already I want to implement in my project to avoid bugs of the past version, but I’m having difficulty making the persistence in the new…