Questions tagged as 'hibernate'

2
answers

Select whether the collection contains a given object with Hibernate Criteria

I'm trying to do a query that would be something like the contains method of the interface I have a class Collection and I want to select the groups if your GrupoProdutos , called Collection , contains a certain produc...
asked by 30.06.2015 / 22:51
1
answer

Identify property of an Object in Java + JPA and change it

I am creating a class to get a record of a database and write to another database. I'm using JPA and I ran into a problem. I'm doing a generic insert and I have to wipe the ID of the table to be able to insert, as it arrives a...
asked by 23.01.2015 / 17: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

Error Building Json of an Object retrieved by Hibernate

Error constructing Json from an object retrieved by Hibernate. session.getTransaction().begin(); ArrayList<Cliente> lista = new ArrayList<>(session.createCriteria(Cliente.class).list()); String json = new Gson().toJson(list...
asked by 13.11.2014 / 15:08
1
answer

Exception org.hibernate.PropertyAccessException: could not set a field value by reflection setter

I'm trying to map the following template in JPA with Hibernate: Company table: CREATE TABLE empresa ( id_empresa INT(11) NOT NULL AUTO_INCREMENT , PRIMARY KEY (id_empresa) ) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1 ROW_FORMAT = FI...
asked by 08.10.2014 / 15:50
1
answer

Problem persisting: "Can not add or update a child row: a foreign key constraint fails ..."

Tables Contact CREATE TABLE IF NOT EXISTS 'sgct-database1'.'contato' ( 'contato_id' SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, 'telefone' CHAR(10) NOT NULL, 'celular' CHAR(11) NULL, PRIMARY KEY ('contato_id')) ENGINE = InnoDB AUTO...
asked by 14.07.2014 / 03:40
1
answer

JPA returning Object other than the class object type

The following query returns java.lang.ClassCastException: [Ljava.lang.Object; can not be cast to br.com.satisfacer.model.Customer public List<Cliente> teste(Cliente cliente) { return manager.createQuery("from Cliente c join c.compras...
asked by 27.08.2018 / 00:48
2
answers

Make a query with criteria hibernate with Spring

Good evening, friends, I have a question. I have a Class called Proposal and another Call Client. In the client there is the CPF field and a Proposal has a Client. I need to search for proposta.cliente.cpf , but I can not, could y...
asked by 11.05.2018 / 04:18
1
answer

Two id in hibernate table

Is there a possibility of two fields being id in a hibernate table? I have two ids that need to be unique in pair on the table. But I do not know how to implement it.     
asked by 15.12.2017 / 00:25
1
answer

Hibernate does not find mysql JDBC driver class in Maven project

Hello everyone, I created a maven project in eclipse (with WAR packaging) and I imported the packages of models already mapped from another project, I then created a class to "load" a factory of persistence but it returns the following error:...
asked by 19.09.2017 / 15:18