|
33 | 33 | import jakarta.persistence.InheritanceType;
|
34 | 34 | import jakarta.persistence.ManyToOne;
|
35 | 35 |
|
36 |
| -import static org.junit.jupiter.api.Assertions.assertEquals; |
37 | 36 |
|
38 | 37 |
|
39 | 38 | /**
|
@@ -135,77 +134,6 @@ public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush, SessionFa
|
135 | 134 | } );
|
136 | 135 | }
|
137 | 136 |
|
138 |
| - @Test |
139 |
| - public void testAssertSubclassInsertedSuccessfullyAfterCommit(SessionFactoryScope scope) { |
140 |
| - final int nEntities = 10; |
141 |
| - |
142 |
| - scope.inTransaction( s -> { |
143 |
| - for ( int i = 0; i < nEntities; i++ ) { |
144 |
| - Employee e = new Employee(); |
145 |
| - e.setName( "Mark" ); |
146 |
| - e.setTitle( "internal sales" ); |
147 |
| - e.setSex( 'M' ); |
148 |
| - e.setAddress( "buckhead" ); |
149 |
| - e.setZip( "30305" ); |
150 |
| - e.setCountry( "USA" ); |
151 |
| - s.persist( e ); |
152 |
| - } |
153 |
| - } ); |
154 |
| - |
155 |
| - scope.inTransaction( s -> { |
156 |
| - long numberOfInsertedEmployee = (long) s.createQuery( "select count(e) from Employee e" ).uniqueResult(); |
157 |
| - assertEquals( nEntities, numberOfInsertedEmployee ); |
158 |
| - } ); |
159 |
| - |
160 |
| - scope.inTransaction( s -> { |
161 |
| - try (ScrollableResults sr = s.createQuery( |
162 |
| - "select e from Employee e" ) |
163 |
| - .scroll( ScrollMode.FORWARD_ONLY )) { |
164 |
| - |
165 |
| - while ( sr.next() ) { |
166 |
| - Employee e = (Employee) sr.get(); |
167 |
| - s.remove( e ); |
168 |
| - } |
169 |
| - } |
170 |
| - } ); |
171 |
| - |
172 |
| - } |
173 |
| - |
174 |
| - @Test |
175 |
| - public void testAssertSubclassInsertedSuccessfullyAfterFlush(SessionFactoryScope scope) { |
176 |
| - |
177 |
| - scope.inTransaction( s -> { |
178 |
| - |
179 |
| - Employee e = new Employee(); |
180 |
| - e.setName( "Mark" ); |
181 |
| - e.setTitle( "internal sales" ); |
182 |
| - e.setSex( 'M' ); |
183 |
| - e.setAddress( "buckhead" ); |
184 |
| - e.setZip( "30305" ); |
185 |
| - e.setCountry( "USA" ); |
186 |
| - s.persist( e ); |
187 |
| - s.flush(); |
188 |
| - |
189 |
| - long numberOfInsertedEmployee = (long) s.createQuery( "select count(e) from Employee e" ).uniqueResult(); |
190 |
| - assertEquals( 1L, numberOfInsertedEmployee ); |
191 |
| - } ); |
192 |
| - |
193 |
| - |
194 |
| - scope.inTransaction( s -> { |
195 |
| - try (ScrollableResults sr = s.createQuery( |
196 |
| - "select e from Employee e" ) |
197 |
| - .scroll( ScrollMode.FORWARD_ONLY )) { |
198 |
| - |
199 |
| - while ( sr.next() ) { |
200 |
| - Employee e = (Employee) sr.get(); |
201 |
| - s.remove( e ); |
202 |
| - } |
203 |
| - } |
204 |
| - } ); |
205 |
| - |
206 |
| - } |
207 |
| - |
208 |
| - |
209 | 137 | @Embeddable
|
210 | 138 | public static class Address implements Serializable {
|
211 | 139 |
|
|
0 commit comments