I don't know if this is a problem with JPA, Spring JPA, or Hibernate, but it is a problem I experience often. The main issue is the lack of error messages.
Problem:
- Attempt to do a persist or merge.
- No errors are shown.
- No data is stored in the database.
- Turning on showSQL... still shows nothing, as if there was no attempt to insert or update to the database.
Is there any way to get error messages, exceptions, anything... back?
Example (there is a one-to-one relationship between A and B):
No insert happens. b has no "id" value. There are no errors thrown, and no clue as to why it fails.
We were always able to work around this problem, but only after wasting many hours... each time. It is so frustrating that our organization is considering dropping JPA altogether and going back to JDBC.
Problem:
- Attempt to do a persist or merge.
- No errors are shown.
- No data is stored in the database.
- Turning on showSQL... still shows nothing, as if there was no attempt to insert or update to the database.
Is there any way to get error messages, exceptions, anything... back?
Example (there is a one-to-one relationship between A and B):
Code:
@Transactional
MyClassA a = em.find(MyClassA.class, idA);
a.setB(b);
b.setA(a);
b = em.merge(b);
return b;
We were always able to work around this problem, but only after wasting many hours... each time. It is so frustrating that our organization is considering dropping JPA altogether and going back to JDBC.