I am attempting to execute this query (in an Oracle DB) with Hibernate/Spring JPA:
@Query( value = "DELETE from MY_TABLE where ID = :ID", nativeQuery = true)
void delete(Long ID);
There is a BEFORE DELETE trigger on the table that is making up for poor table design that I cannot change, it runs around deleting rows from dependent tables so that the base DELETE doesn't cause any foreign key errors. I am fairly sure this shouldn't be an issue, but if it is let me know.
Now then, on execution this query causes a ORA-01002: fetch out of sequence
error which, according to google, is caused when a fetch has been attempted from a cursor which is no longer valid
. (To be completely clear, I have not initiated any cursors with my query or my trigger)
BUT, the row and all its dependants are actually being deleted successfully. Because of this I am not sure what is causing the error and would like yalls' help
The method should be :
@Modifying
@Query( value = "DELETE from MY_TABLE where ID = :ID", nativeQuery = true)
void delete(@Param("ID") Long ID);
Try this and check if the issue still exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With