Questions tagged as 'jpa'

1
answer

What is the benefit of using interfaces for services in Spring MVC?

Suppose I have the following JPA repository: public interface IGreetingRepository extends JpaRepository<Greeting, Long> { } And according to the documentation I would have to generate a service interface as follows: public interface...
asked by 29.12.2015 / 00:38
1
answer

JPA entities are not saved correctly

I have the following entities, all related as follows: @Entity @Table(name = "site") public class Site extends BaseEntity { /** * Serial */ private static final long serialVersionUID = -6249200015501840399L; private Str...
asked by 22.12.2015 / 19:39
1
answer

Join tables with JPA

I request your help because I need to make a union of two tables in a query in order to create a list, but I do not know how to do it, this is the query that you create: SELECT p.id, p.nombre_departamento, p.ciudad_departamento,...
asked by 15.05.2016 / 17:57
2
answers

After an UPDATE, I execute a select but the data is not updated

I'm working JPA, I run the following update: public int EditarUsuario(UserSys us) { EntityManager em = getEntityManager(); em.getTransaction().begin(); try { Query q = em.createNativeQuery("UPDATE 'user_sys' "...
asked by 25.04.2016 / 23:14
1
answer

Expression of type List needs unchecked conversion to conform to List

I have a repository class that implements another method to obtain all my clients @Repository public class ClienteRepositoryImpl implements ClienteRepository{ private EntityManager em; @Override @Transactional(readOnly = true)...
asked by 22.02.2018 / 15:05
1
answer

JPA problems persisting cascading a subclass

I have the following classes @Entity @Table(name = "personas") @Inheritance(strategy = InheritanceType.JOINED) @ClassExtractor(PersonExtractor.class) abstract public class Persona implements AbstractEntity<Long>, Serializable { privat...
asked by 02.03.2018 / 00:17
2
answers

SQL Contains: Escaping query operators

I had a query running for some time (mounted by JPA) when suddenly I was given an exception:    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.hibernate3.HibernateJd...
asked by 15.09.2016 / 12:17
2
answers

Create query in a repository in spring

I have a repository and in its interface I want to create a function that requests a String and returns an object of type user, in mysql the syntax would be like this: SELECT C.NOMBRE FROM CLIENTE C, ALIAS A WHERE A.NOMBRE = 'bar' AND A.CLIENT...
asked by 02.03.2017 / 17:49
1
answer

Hibernate @ManyToMany doubts

I'm quite a rookie as far as Hibernate is concerned, the fact is that looking at the documentation of the annotation @ManyToMany a question has arisen, which is quite appropriate to my case, and is as follows: Let's say the case that I...
asked by 11.08.2018 / 22:40
1
answer

JPA @ManyToMany how to bring related objects

I'm mapping two objects: Professor and Vehicles, it's a n to n relationship so I'm using a relationship table called "rel_prof_vehicle". The problem comes when it comes to obtaining any object Professor or Vehicles, it brings me the whole object...
asked by 27.03.2018 / 22:08