Questions tagged as 'jpa-2.0'

3
answers

Save same object multiple times

Solution: setar id = null The code saves 10 times if it runs on the Tomcat server, but if it runs on Glassfish it only adds one time. <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xm...
asked by 29.01.2014 / 14:09
2
answers

I can not save to the database in a Spring MVC project

I'm going to explain the project because I believe that most people usually create the projects using XML, and I created the Spring MVC project by dismissing the files that configure the project as XML. The problem with my project is that I c...
asked by 21.10.2015 / 03:19
1
answer

Why does the EntityManager not have the createQuery method with a typed return?

I'm following the Spring-MVC book project of House Do Code, using the latest version of Hibernate, 4.0.3. But at a time, when the book indicated the creation of a quoted query through the following code: // manager é um objeto da classe jav...
asked by 09.11.2015 / 21:58
1
answer

Spring Bean sessionFactory with NullPointerException error

Good morning. I'm trying to make a setting in the spring-jpa.xml file to support a multitenancy architecture by separating each client by Schema. I use a dataSource that has been configured in JBoss Wildfly to connect to the database where th...
asked by 06.02.2015 / 12:46
1
answer

Create JPA project without persistence.xml?

I created a project with Swing and JPA and it is working fine, now I want to remove the file persistence.xml and create a class to work on it. I'm researching some way to do this and found in the documentation an example of how to here...
asked by 05.09.2016 / 21:15
2
answers

Select JPA and Hibernate

I have five entities (Quotation, Sector, Partner, Items and Leads), where the user will select a quotation and sector and the list of all items related to this sector will appear along with the items that have already been posted ( if any). I...
asked by 21.08.2015 / 04:36
1
answer

Relationship of classes by collections in JPA2

In a bean that has a OneToMany link, with others, through a HashMap what annotations should be used? @Entity class Rodada{ public HashMap<Pergunta,Resposta> perguntas;     
asked by 29.09.2014 / 21:27
2
answers

How do I select in specific columns and continue to get a list of the entity and not an array of Object?

Having the following class: public class Usuario { private Integer id; private Email email; private String nome; private String sobrenome; private String senha; private String usuario;...
asked by 30.01.2018 / 10:10
1
answer

Compound key problems in JPA

Hello, I'm kind of new to JPA and I'm having trouble with a compound PK. The class Aluno follows: @Entity @Table(name = "Aluno") public class Aluno { @Id private String ra; @Column(length = 50, nullable = false) pri...
asked by 19.08.2016 / 06:07
1
answer

JPA does not persist the Object in the bank

I have a problem in which I try to persist data in the Bank 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 is presented. Follow below as I'm doing: pub...
asked by 17.06.2015 / 20:26