Questions tagged as 'hibernate'

4
answers

Specific use of try-catch

I'm studying Hibernate and with it came some doubts that have come to me before but did not question in depth. public void salvar(Usuario usuario){ Session sessao = null; Transaction transacao = null; try{ sessao = Hiberna...
asked by 15.01.2016 / 14:22
1
answer

Use the same entity in Hibernate to write to two tables

I am using Hibernate to persist in the database, and in a given case, for every update that a given Consultor ed entity has, it should update in the main table called TB_Consultor and insert a new line in the TB_ConsultorHistorico...
asked by 17.01.2014 / 18:45
2
answers

How to make the GenericDAO class using Hibernate?

I wanted to know the best way to do a generic Dao of a project, using Hibernate and JPA in Java. That's all to avoid setting up a DAO for each object that will persist in the database: public class ProdutoDao { private final EntityMana...
asked by 21.07.2015 / 04:36
2
answers

Criteria API - Hibernate vs JPA 2

I'll try to phrase this question as unthinkingly as 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 API (while it is technically possible to mix the two, for...
asked by 18.12.2013 / 15:17
1
answer

Problems 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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html x...
asked by 20.05.2015 / 21:57
2
answers

Error updating the entire JAVA table

I am trying to perform a mass update to update all the prices of products registered in the system, adding the value passed by the user to the unit price of the product registered, according to the company entered in the system and the product c...
asked by 18.02.2016 / 14:03
2
answers

Connection with the Bank falls after a certain time

I have a server where I have several web applications connected to the database ( Mysql ). The problem is that if some system is idle it loses the connection with the bank and I have to give a refresh in the application so that everything...
asked by 18.12.2015 / 14:30
1
answer

Differences @OneToMany, @ManyToMany, @ManyToOne, @OneToOne [duplicate]

I wanted to mount a database with Java Hibernate like the one below: Questions: What is the difference between @OneToMany , @ManyToMany , @ManyToOne , @OneToOne ? And what would your statement look like in...
asked by 04.09.2017 / 20:26
2
answers

Best way to use and Instantiate the EntityManagerFactory

My project has the following structure: Withinthebr.mandacaru.DAOpackagearethecontrollers.ToinstantiateaJPAControllerobjectIneedaEntityManagerFactoryobjectandforthisreasonIcreatedaEntityManagerProviderclassthathasagetEntityManagerFactorymetho...
asked by 03.01.2015 / 18:10
3
answers

Working with the JPA + Hibernate cache

I have questions about how to work with objects EntityManagerFactory and EntityManager . Currently I instantiate a EntityManagerFactory for the whole system, as I only have one bank, I create only one and use it to create...
asked by 15.01.2015 / 21:14