0

I have a Java application and have created a Repository class to query my Oracle Database.

The persistence query below that I am using is causing an error.

Query:

Query query = persistence.entityManager().createNativeQuery("Select * from PERSON WHERE ID = ?");
        query.setParameter(1, id);

The error I am getting is:

Error : Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1javax.persistence.OptimisticLockException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

What could be causing this, and how can I solve it?

MichaelS
  • 5,941
  • 6
  • 31
  • 46
java123999
  • 6,974
  • 36
  • 77
  • 121

1 Answers1

-1

can you try this?

query = persistence.entityManager().createNativeQuery("Select * from PERSON WHERE ID = ?1");