Questions tagged as 'jpa'

0
answers

Hibernate: query performance drop after a few repetitions

I am developing a Farm Management system. One of the basic queries is to list the animals by type that are alive (% with%). Below is the method that performs this query. public List<T> findByInFarm(T model, boolean inFarm) throws DAOExce...
asked by 23.06.2017 / 16:10
1
answer

Unable to build entity manager factory

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" versio...
asked by 22.06.2017 / 17:36
1
answer

Creating the "persistence.xml" JPA / Hibernate file

I wonder if there is a way to setup the creation (the settings) of persistence.xml at the time of project creation. Example of aqruivo: <!-- propriedades do hibernate --> <property name="hibernate.dialect" value="org.hibe...
asked by 14.06.2017 / 15:34
1
answer

Mount List mapped with @ManyToOne only with some objects

Is it possible to assemble a list in a class with only a few objects? @NamedQuery(name = "Curso.Aprovados", query = "select cur from Classificacao cl JOIN cl.candidato ca JOIN ca.curso cur") public class Curso { @Id @Co...
asked by 25.05.2017 / 20:57
1
answer

using EntityManager to return a List

Well, I'm having a problem when I get a list of phones from the bank, these phones have to belong to a CPF. In my query I do this public List<Telefone> buscar(Proprietario proprietario) { return this.manager.createQuery("select...
asked by 19.05.2017 / 03:56
2
answers

JPA - Java does not insert data into the database

Bean @Named("proprietarioMB") public class ProprietarioBean implements Serializable { private static final long serialVersionUID = 1L; @Inject private ProprietarioService proprietarioService; @Inject private Propri...
asked by 15.05.2017 / 20:29
1
answer

Value '0000-00-00' can not be represented as java.sql.Date

I need to get a table named history the last three months and a year before to register in the product table. The code is as follows: for (int i = prod.getHistoricos().size(); i >= 0; i--) { if (i == prod.getHistoricos().si...
asked by 19.06.2017 / 18:54
0
answers

Data does not persist in bank

I have a PrimeFaces3.5, JSF 2.1 and JPA 2.0 application I'm uploading a file that does not persist in the database, but the outputs on the console are ok. I do not understand why you're not committing. Why does not it work? Bean code:...
asked by 08.05.2017 / 21:23
0
answers

How to check if my table has related records?

I'm developing a project using JPA and with various relationship types like OneToMany, ManyToMany, etc. Is there any way I can check if an X table for example has related records in another Y table? I can use Reflection but I do not see this...
asked by 20.04.2017 / 21:03
1
answer

IllegalArgumentException: illegal value in JPA when recovering JSpinner value

I'm testing an event on a JTable of type tableMouseClicked(evt) , but I'm having some errors returning the values in the respective JTextField and a JSpinner I've set up. Below is the Stack Trace for the given output when I click on...
asked by 07.04.2017 / 19:49