Questions tagged as 'jpa'

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
2
answers

How to use MySQL view's with Spring Data and eclipselink

In the development of my project I came across a select that will require a lot of application performance, since it consists in the use of two join's. Soon I came to mind creating a view in MySQL, but the problem is that I never used it consume...
asked by 19.11.2014 / 20:32
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
1
answer

Java Spring - Repository returns Null

This is my ApiKey class: @Entity @Table(name="API_KEYS", schema="DEMO_PIMS") @JsonIgnoreProperties(allowGetters=true) public class ApiKey implements Serializable{ private static final long serialVersionUID = 1L; @Id @Column(n...
asked by 27.06.2018 / 16:16
1
answer

How do I return in json the foreign key in Spring Boot?

As you can see, he is returning cities without any problems at the following URL: http://localhost:8080/cidades , please note: Thisisadirectreturnfromthedatabasewithselect*fromcidade,canyouseeanydifference? Notethatinthestatus_codeattr...
asked by 02.02.2018 / 19:46
2
answers

Tables are not created automatically by Hibernate in MySQL

Hibernate can not create the table in the database already created (drugstore). Follow the code below. Hibernate.cfg.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hiberna...
asked by 16.08.2016 / 14:11
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
1
answer

How to generate default values with JPA hibernate [closed]

I would like to optimize my code and my work with the following situation. I have an entity address that has one type, that is, another entity called TpEndereco. Since this table has default values, for example: commercial, other, residential .....
asked by 07.01.2016 / 19:18