Questions tagged as 'jpa-2.0'

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

How to prevent the List.size () method from executing lazyload with Hibernate and JPA

When I make a query in the database and an object is returned, that object has a collection, which by default is Lazyload, if I do object.getColecao().size() it runs the lazyload to bring the records, whether the session or the entitymanag...
asked by 04.02.2014 / 23:13
1
answer

Unique key violated when I am doing a delete. Because?

I have a problem that seems silly but I'm skating and I can not solve it. I have a legal application made in Java using JPA 2 with Spring, Spring Data, JSF, etc ... It works very well. The base I'm using is Oracle 10g. Well now comes the prob...
asked by 06.06.2014 / 00:39
2
answers

EntityManager with JTA multiple connections

I'm having a rather unusual problem, but I'm looking for a solution. I have a scenario where I have several database bases (postgresql) allocated on multiple clients, all databases have the same structure, but with different records. I hav...
asked by 19.09.2014 / 19:33
2
answers

Multiple persistence units with Spring Data

Is it possible to create multiple persistences units by connecting to different databases in the same JPA application using Spring Data? For example. I have an application that will run on MySQL normally. However, it will have to query in an O...
asked by 15.01.2015 / 13:24
2
answers

FetchType.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 the relations in the database, because it would be very cumbersome, just for this query I can change the parameter to Lazy...
asked by 17.04.2014 / 15:35
1
answer

How to query in ManyToMany tables?

I have two tables / entities in the database with the following attributes: Car (code, plate, color) Accessory (code, description). public Carro buscarCarroComAcessorio(Long codigo) { return (Carro) em.createQuery("select c from Carro...
asked by 07.10.2015 / 15:28
1
answer

Data modeling via JPA and Hibernate

I am doing a project with JPA for a quotation system and I have doubts on how to build the relationship between classes, and would like (if possible) some opinions. My project is a quotation system, where the company will create a quote and s...
asked by 08.08.2015 / 22:16
2
answers

PrimaryKey, ForeignKey and Unique With JPA

I have the following situation: Entity Student (id and so on) Evaluation Entity (id and others) Entity NoteEvaluationAlumni (assessmentId, studentId) I want to transform the evaluation attributes, alunoId that have relations with enti...
asked by 13.08.2014 / 16:23