3838import org .springframework .data .jdbc .core .convert .IdGeneratingEntityCallback ;
3939import org .springframework .data .jdbc .repository .config .EnableJdbcRepositories ;
4040import org .springframework .data .jdbc .repository .support .SimpleJdbcRepository ;
41+ import org .springframework .data .jdbc .testing .EnabledOnFeature ;
4142import org .springframework .data .jdbc .testing .IntegrationTest ;
4243import org .springframework .data .jdbc .testing .TestConfiguration ;
44+ import org .springframework .data .jdbc .testing .TestDatabaseFeatures ;
4345import org .springframework .data .relational .core .conversion .MutableAggregateChange ;
4446import org .springframework .data .relational .core .mapping .NamingStrategy ;
4547import org .springframework .data .relational .core .mapping .Sequence ;
4648import org .springframework .data .relational .core .mapping .event .BeforeConvertCallback ;
4749import org .springframework .data .repository .CrudRepository ;
4850import org .springframework .data .repository .ListCrudRepository ;
49- import org .springframework .test . context . jdbc . Sql ;
51+ import org .springframework .jdbc . core . namedparam . NamedParameterJdbcOperations ;
5052
5153/**
5254 * Testing special cases for id generation with {@link SimpleJdbcRepository}.
5961@ IntegrationTest
6062class JdbcRepositoryIdGenerationIntegrationTests {
6163
64+ @ Autowired NamedParameterJdbcOperations operations ;
6265 @ Autowired ReadOnlyIdEntityRepository readOnlyIdRepository ;
6366 @ Autowired PrimitiveIdEntityRepository primitiveIdRepository ;
6467 @ Autowired ImmutableWithManualIdEntityRepository immutableWithManualIdEntityRepository ;
@@ -123,9 +126,11 @@ void manuallyGeneratedIdForSaveAll() {
123126 }
124127
125128 @ Test // DATAJDBC-2003
126- @ Sql ( statements = "INSERT INTO SimpleSeq(id, name) VALUES(1, 'initial value');" )
129+ @ EnabledOnFeature ( TestDatabaseFeatures . Feature . SUPPORTS_SEQUENCES )
127130 void testUpdateAggregateWithSequence () {
128131
132+ operations .getJdbcOperations ().update ("INSERT INTO SimpleSeq(id, name) VALUES(1, 'initial value');" );
133+
129134 SimpleSeq entity = new SimpleSeq ();
130135 entity .id = 1L ;
131136 entity .name = "New name" ;
@@ -137,8 +142,8 @@ void testUpdateAggregateWithSequence() {
137142 assertThat (afterCallback .join ().id ).isEqualTo (1L );
138143 }
139144
140- @ Test
141- // DATAJDBC-2003
145+ @ Test // DATAJDBC-2003
146+ @ EnabledOnFeature ( TestDatabaseFeatures . Feature . SUPPORTS_SEQUENCES )
142147 void testInsertPersistableAggregateWithSequenceClientIdIsFavored () {
143148
144149 long initialId = 1L ;
@@ -153,6 +158,7 @@ void testInsertPersistableAggregateWithSequenceClientIdIsFavored() {
153158 }
154159
155160 @ Test // DATAJDBC-2003
161+ @ EnabledOnFeature (TestDatabaseFeatures .Feature .SUPPORTS_SEQUENCES )
156162 void testInsertAggregateWithSequenceAndUnsetPrimitiveId () {
157163
158164 PrimitiveIdSeq entity = new PrimitiveIdSeq ();
0 commit comments