Questions tagged as 'jpa'

1
answer

@Size, using hibernate validator, acknowledges error in value that should pass validation

I have a Java SE application where I can not use the @size annotation. This annotation is handled by org.hibernate.validator.Size. It has a user field in the template in which I do this: @Size(min = 1, max = 30) @Column(name = "CAMPO")...
asked by 06.08.2015 / 20:16
1
answer

Understanding the same method in the repository and service

Why in the service and in the controller do the objects point to the same function? I'll detail: Repository: @RepositoryRestResource(exported = false) public interface AtividadeRepository extends CrudRepository<Atividade, Integer> {...
asked by 10.09.2015 / 16:20
1
answer

Verify that the data entered by the user already exists in the database before inserting

I need to check in the database if the information that the user is trying to insert already exists, for example: In the registration of a company, I can not allow the same CNPJ for others. I'm doing in JSF 2 with JPA2 Hibernate. I did an exa...
asked by 20.04.2015 / 15:53
1
answer

Error changing application from H2 to PostgreSQL

I was developing a benchmarking application H2 just for testing and everything was working. When I finished the implementation I changed the connection from JPA to PostgreSQL , but when I did this the system stopped persis...
asked by 31.05.2015 / 16:06
1
answer

JPA - Two OneToOne and OneToMany relationships between the same class

I have a Student class and it has two relationships with Pessoa a OneToOne and OneToMany and person in turn a relationship with Endereco , as shown below: Student Class @Entity @Table(name = "ESTUDANTE") public cla...
asked by 29.04.2015 / 13:27
1
answer

Error in NamedQuery

Good evening guys, I'm trying to create a namedquery with a query in the database. Following: @NamedQuery(name="ListagemProdutosMesa",query="select Produto p FROM Produto p, Pedido pe, Conta c, Pedido_produto pp where pe.id = pp.pedido...
asked by 13.05.2015 / 03:58
1
answer

Error in ManyToMany relationship in Hibernate

I have a problem with @manyToMany . It's giving the error:    org.hibernate.loader.MultipleBagFetchException: can not simultaneously fetch multiple bags Follow my template: @Entity @Table(name = "sar_evento", schema = "sar") @Sequ...
asked by 20.10.2014 / 20:46
1
answer

JPA with the Java 8 Date API

With the many enhancements to the new Java 8 DateTime API, how should I instantiate a Date for an entity in JPA? Is it possible, for example, to have a YearMonth field that JPA controls?     
asked by 15.07.2014 / 05:45
1
answer

Problem with JPA [closed]

Classes and persistence.xml below. The problem is: entityManager is coming NULL. @ManagedBean(name="pessoaController") @SessionScoped public class PessoaController{ private List<Pessoa> pessoas = new ArrayList<Pessoa>(...
asked by 04.04.2014 / 19:12
1
answer

JPQL to query date / time of bank with hibernate without native query

Is there a way to query the database date / time without using active query ? In Oracle I do this: SQLQuery qry = session.createSQLQuery("SELECT SYSDATE FROM dual"); But I would like a generic query to not price the database.     
asked by 17.04.2014 / 19:12