Questions tagged as 'jpa'

0
answers

how to use query with more than one field (.vo template) in a datamodel

I have the following query and am wanting to put this list with products and the summation in a datamodel list. public List<Filtro> listarProdutosDoGerenteRegional() { try { return manager.createQuery(...
asked by 28.06.2017 / 18:00
0
answers

Display database image in dataTable

I saved an image in the database and want to display it in a dataTable PS: I know that it is not good practice to store image within the database, this practice was done for study purposes. <h:form style="margin:auto;margin-left:2%;"...
asked by 14.06.2017 / 18:27
1
answer

JPQL query help

I am trying to return a group query along with the product entity returning all the data from the product table and the sum of the quantity. I get an error that is as follows: Exception in thread "main" java.lang.IllegalArgumentException: Type...
asked by 27.06.2017 / 18:46
2
answers

Hibernate does not automatically create table in mysql

I'm studying Spring with a bit of Hibernate, where I stopped in a situation I can not get through. I've set up the hibernate code for creating tables in the database, but when I run the application it does not create. My template class:...
asked by 17.04.2017 / 21:15
1
answer

How to map an entity with compound key using JPA?

@Entity @Table(name = "USUARIO") public class Usuario implements Serializable { @Id @GeneratedValue(strategy= GenerationType.AUTO) @Column(name = "ID") private Long id; @Column(name = "USER_NAME", nullable = false) pri...
asked by 03.05.2017 / 16:49
1
answer

Problem to retrieve data using Hibernate

I can list the Customer and their Animals, but I can not list the Breeds of animals. Follow the classes involved in the relationship: Client Class @Entity public class Cliente extends Pessoa { @Column(name="forma_pagamento", length=20...
asked by 09.04.2017 / 05:44
0
answers

Incorrect date / time format

In my following code snippet: String horario = evento.getDataOcorrencia().concat(" ").concat(evento.getHoraOcorrencia()); horario = horario.replaceAll("/", "-"); SimpleDateFormat dateFormat = new SimpleD...
asked by 28.03.2017 / 13:07
0
answers

Persists @ManyToOne NULL

I have a User class and another Contact which have a relationship between them. It's all working correctly the question that I need to only write a contact if there is any filled contact attribute, but if the user only fill the mandatory user at...
asked by 07.12.2016 / 15:17
1
answer

Difference of character enconding Charset difference using JPA but not with prepared statement

I have an application using spring boot + oracle (via tomcat datasource). Using spring-data, a simple query in a table returns characters with an encoding problem. This same application, in a very specific situation, I create a direct (no dat...
asked by 23.12.2016 / 01:13
0
answers

Hibernate does not update information

My problem is that an unsuccessful update follows the code below. EntityManager manager=JpaUtil.getEntityManager(); EntityTransaction trx= manager.getTransaction(); trx.begin(); TypedQuery<Tipi> query = manager.cr...
asked by 03.11.2016 / 14:28