Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

Insert/update troubleshooting

$
0
0
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):
Code:

@Transactional
MyClassA a = em.find(MyClassA.class, idA);
a.setB(b);
b.setA(a);
b = em.merge(b);
return 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.

Viewing all articles
Browse latest Browse all 297

Trending Articles