diff --git a/src/main/java/jp/co/future/uroborosql/AbstractExtractionCondition.java b/src/main/java/jp/co/future/uroborosql/AbstractExtractionCondition.java index 2991bdbb..5bfe375d 100644 --- a/src/main/java/jp/co/future/uroborosql/AbstractExtractionCondition.java +++ b/src/main/java/jp/co/future/uroborosql/AbstractExtractionCondition.java @@ -555,6 +555,16 @@ public T where(final CharSequence rawString, final Map paramMap) return (T) this; } + /** + * {@inheritDoc} + * + * @see jp.co.future.uroborosql.fluent.ExtractionCondition#contextAttrs() + */ + @Override + public Map contextAttrs() { + return context().contextAttrs(); + } + /** * 条件指定用のラップクラス */ diff --git a/src/main/java/jp/co/future/uroborosql/fluent/ExtractionCondition.java b/src/main/java/jp/co/future/uroborosql/fluent/ExtractionCondition.java index bb399504..2287eb12 100644 --- a/src/main/java/jp/co/future/uroborosql/fluent/ExtractionCondition.java +++ b/src/main/java/jp/co/future/uroborosql/fluent/ExtractionCondition.java @@ -307,4 +307,10 @@ public interface ExtractionCondition { */ T where(CharSequence rawString, Map paramMap); + /** + * ExecutionContextが保持する属性を取得する + * @return ExecutionContext属性情報 + */ + Map contextAttrs(); + } \ No newline at end of file diff --git a/src/test/java/jp/co/future/uroborosql/SqlEntityDeleteTest.java b/src/test/java/jp/co/future/uroborosql/SqlEntityDeleteTest.java index 3d65d370..e4154ff5 100644 --- a/src/test/java/jp/co/future/uroborosql/SqlEntityDeleteTest.java +++ b/src/test/java/jp/co/future/uroborosql/SqlEntityDeleteTest.java @@ -61,4 +61,11 @@ void testDeleteThrowException() { }); } + @Test + void testContextAttrs() { + var delete = agent.delete(Product.class); + delete.contextAttrs().put("dummyValue", Integer.MAX_VALUE); + assertThat(delete.contextAttrs().get("dummyValue"), is(Integer.MAX_VALUE)); + } + } diff --git a/src/test/java/jp/co/future/uroborosql/SqlEntityQueryTest.java b/src/test/java/jp/co/future/uroborosql/SqlEntityQueryTest.java index 5d56503a..75830407 100644 --- a/src/test/java/jp/co/future/uroborosql/SqlEntityQueryTest.java +++ b/src/test/java/jp/co/future/uroborosql/SqlEntityQueryTest.java @@ -481,4 +481,11 @@ void testOptimizerHints() { assertThat(products.size(), is(2)); } + @Test + void testContextAttrs() { + var query = agent.query(Product.class); + query.contextAttrs().put("dummyValue", Integer.MAX_VALUE); + assertThat(query.contextAttrs().get("dummyValue"), is(Integer.MAX_VALUE)); + } + } diff --git a/src/test/java/jp/co/future/uroborosql/SqlEntityUpdateTest.java b/src/test/java/jp/co/future/uroborosql/SqlEntityUpdateTest.java index 4e37a42f..fb8c1b7a 100644 --- a/src/test/java/jp/co/future/uroborosql/SqlEntityUpdateTest.java +++ b/src/test/java/jp/co/future/uroborosql/SqlEntityUpdateTest.java @@ -532,6 +532,13 @@ void testEntityUpdateWithId() throws Exception { }); } + @Test + void testContextAttrs() { + var update = agent.update(TestEntity.class); + update.contextAttrs().put("dummyValue", Integer.MAX_VALUE); + assertThat(update.contextAttrs().get("dummyValue"), is(Integer.MAX_VALUE)); + } + @Table(name = "test_entity") public static class TestEntity { @Id