mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1471 - Change stateless update on bean with no @Version property that updates 0 rows to throw EntityNotFoundException
This commit is contained in:
@@ -11,6 +11,7 @@ import org.tests.model.basic.EBasic.Status;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -70,6 +71,28 @@ public class TestStatelessUpdate extends TransactionalTestCase {
|
||||
|
||||
}
|
||||
|
||||
@Test(expected = EntityNotFoundException.class)
|
||||
public void update_NoRowsUpdated_expect_EntityNotFoundException() {
|
||||
|
||||
EBasic basic = new EBasic();
|
||||
basic.setId(999999999);
|
||||
basic.setName("something");
|
||||
basic.setStatus(Status.ACTIVE);
|
||||
|
||||
Ebean.update(basic);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delete_NoRowsDeleted_expect_false() {
|
||||
|
||||
EBasic basic = new EBasic();
|
||||
basic.setId(999999999);
|
||||
basic.setName("something");
|
||||
basic.setStatus(Status.ACTIVE);
|
||||
|
||||
assertThat(Ebean.delete(basic)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* I am expecting that Ebean detects there aren't any changes and don't execute any query.
|
||||
* Currently a {@link javax.persistence.PersistenceException} with message 'Invalid value "null" for parameter "SQL"' is thrown.
|
||||
|
||||
Reference in New Issue
Block a user