Questions tagged as 'jpa'

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
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
1
answer

The name of the dt_ultimo_acesso column was not found in this ResultSet

I'm deploying a method by passing an id parameter: @RequestMapping(method = RequestMethod.GET, value = "/entidadesUsuario/{id}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Collection<Usuarios>> buscarEnt...
asked by 20.10.2017 / 17:27
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
1
answer

Paging with large amount of data

Thinking about performance, what is the best way to page a large amount of data? I'm currently using a List<Produtos> , saving around 500 products in it, and using subList(min,max) , returns what I need. However, I think t...
asked by 27.04.2016 / 16:28
1
answer

CascadeType.ALL does not work. Am I using it wrong?

In my code, I have the Author and Book classes with the Many To One relationship, as below: Author.java import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.F...
asked by 20.12.2016 / 14:03
1
answer

Business object validation avoiding / reducing use of if's and else's

I have a problem where I have three types of employee (EmployeeA, EmployeeB, EmployeeC), all of which will be stored in a table named Employee and their respective relationships, but these types mentioned above have different validations between...
asked by 23.06.2014 / 17:02
1
answer

Multi Tenancy with Hibernate update schema

Hello, I'm using an application that uses multiple (multi-tenancy) databases using hibernate. I would like to know if anyone knows any way Hibernate can do the update in the schema of the banks. I have already set the hibernate.hbm2dll.auto: upd...
asked by 05.07.2016 / 22:38
2
answers

Problems with lazy Hibernate

Friends, all good? I have a problem that is famous: org.hibernate.LazyInitializationException: . I know this is because the session has been closed and hibernate can not connect to make the selects and so on, but then how do I get the dat...
asked by 20.05.2015 / 15:47