Questions tagged as 'jpa'

1
answer

Attempt to update registry ID not allowed with JPA and EclipseLink

How do I allow a record ID to be updated with JPA and EclipseLink? The following exception is thrown when I try to update the ID:    Caused by: Exception [EclipseLink-7251] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.ecli...
asked by 29.05.2014 / 19:07
1
answer

JPA return from the Many side of an entity @OneToMany using @OrderBy

I have the following Cliente entity that has Pedidos . The relationship between clients and requests is mapped with Cliente @OneToMany and Pedidos @ManyToOne . What I need is for the Customer Requests list to be sorted by...
asked by 15.08.2018 / 15:30
1
answer

JavaSE with CDI and JPA - Error WELD-001303

I am studying JPA and CDI in a Java SE application. When I create the EntityManagerFactory I come across the error: Exception in thread "main" org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope t...
asked by 13.06.2015 / 22:58
3
answers

Map java.time properties with Hibernate and / or JPA

Is there any way to map properties like java.time.LocalDate and / or java.time.Instant through JPA and / or Hibernate?     
asked by 05.07.2014 / 23:28
2
answers

Problem changing the type of a column in the model using JPA annotation

I have a column in the database that is limited to receiving a varchar(255) , but I need to change that to a larger size. For this I have added these annotations in the field: @Column(nullable = true, columnDefinition = "TEXT") @Lengt...
asked by 22.04.2015 / 21:54
2
answers

Check and edit a List

I have a List: private List<Geracao> lista; This list will be populated with data coming from a database: lista = dao.findAll(); The findAll() method: @SuppressWarnings("unchecked") @Override public List<Gerac...
asked by 17.11.2016 / 11:40
1
answer

What are the cascade types in JPA?

I'm looking for information on the cascade types that exist and how they work in relational modeling with JPA. The types I found explanations were: NONE = Do not do anything with the object (default) MERGE = Update children when updat...
asked by 28.03.2017 / 22:35
1
answer

JPA subselect in MANYTOMANY

I'm developing a system with java + jpa + mysql but now I have a question that I still can not find the answer ... Given the tables and entities below, I would like to set up a jpql to perform the following query in native SQL: SELECT * FROM p...
asked by 24.09.2015 / 20:20
2
answers

Invalid property 'category.subcategory' of bean class. Error saving user to bank

I'm developing a web application that has the following mapping: A user has a category; A category has several subcategories; a subcategory has several products. As the image below: WhatIamtryingtoimplementis:whentheadminregistersanewsupplierhe...
asked by 13.06.2018 / 01:52
1
answer

How to map entity with hibernate to create non-unique constraints?

I'm trying to create an entity with the following mapping: @Entity @IdClass(AutenticacaoPK.class) public class Autenticacao { @Id @OneToOne(cascade = CascadeType.REFRESH) @JoinColumn(name = "codUsuario", unique = false) private Usuari...
asked by 11.06.2015 / 20:09