|
33 | 33 | import org.hibernate.boot.model.source.spi.AttributeRole;
|
34 | 34 | import org.hibernate.boot.model.source.spi.AttributeSource;
|
35 | 35 | import org.hibernate.boot.model.source.spi.AttributeSourceContainer;
|
36 |
| -import org.hibernate.boot.model.source.spi.ConstraintSource; |
37 | 36 | import org.hibernate.boot.model.source.spi.EntityHierarchySource;
|
38 | 37 | import org.hibernate.boot.model.source.spi.EntityNamingSource;
|
39 | 38 | import org.hibernate.boot.model.source.spi.EntitySource;
|
@@ -79,9 +78,6 @@ public abstract class AbstractEntitySourceImpl
|
79 | 78 |
|
80 | 79 | private final ToolingHintContext toolingHintContext;
|
81 | 80 |
|
82 |
| - private Map<String, ConstraintSource> constraintMap = new HashMap<String, ConstraintSource>(); |
83 |
| - |
84 |
| - |
85 | 81 | protected AbstractEntitySourceImpl(MappingDocument sourceMappingDocument, JaxbHbmEntityBaseDefinition jaxbEntityMapping) {
|
86 | 82 | super( sourceMappingDocument );
|
87 | 83 | this.jaxbEntityMapping = jaxbEntityMapping;
|
@@ -223,86 +219,12 @@ public AttributeSourceContainer getAttributeSourceContainer() {
|
223 | 219 | public void addAttributeSource(AttributeSource attributeSource) {
|
224 | 220 | attributeSources.add( attributeSource );
|
225 | 221 | }
|
226 |
| - |
227 |
| - @Override |
228 |
| - public void registerIndexColumn(String constraintName, String logicalTableName, String columnName) { |
229 |
| - registerIndexConstraintColumn( constraintName, logicalTableName, columnName ); |
230 |
| - } |
231 |
| - |
232 |
| - @Override |
233 |
| - public void registerUniqueKeyColumn(String constraintName, String logicalTableName, String columnName) { |
234 |
| - registerUniqueKeyConstraintColumn( constraintName, logicalTableName, columnName ); |
235 |
| - } |
236 | 222 | };
|
237 | 223 | buildAttributeSources( attributeBuildingCallback );
|
238 | 224 |
|
239 | 225 | return attributeSources;
|
240 | 226 | }
|
241 | 227 |
|
242 |
| - private void registerIndexConstraintColumn(String constraintName, String logicalTableName, String columnName) { |
243 |
| - getOrCreateIndexConstraintSource( constraintName, logicalTableName ).addColumnName( columnName ); |
244 |
| - } |
245 |
| - |
246 |
| - private IndexConstraintSourceImpl getOrCreateIndexConstraintSource(String constraintName, String logicalTableName) { |
247 |
| - IndexConstraintSourceImpl constraintSource = (IndexConstraintSourceImpl) constraintMap.get( constraintName ); |
248 |
| - if ( constraintSource == null ) { |
249 |
| - constraintSource = new IndexConstraintSourceImpl( constraintName, logicalTableName ); |
250 |
| - constraintMap.put( constraintName, constraintSource ); |
251 |
| - } |
252 |
| - else { |
253 |
| - // make sure we have the same table name... |
254 |
| - if ( !EqualsHelper.equals( constraintSource.getTableName(), logicalTableName ) ) { |
255 |
| - throw new MappingException( |
256 |
| - String.format( |
257 |
| - Locale.ENGLISH, |
258 |
| - "Named relational index [%s] referenced more than one table [%s, %s]", |
259 |
| - constraintName, |
260 |
| - constraintSource.getTableName() == null |
261 |
| - ? "null(implicit)" |
262 |
| - : constraintSource.getTableName(), |
263 |
| - logicalTableName == null |
264 |
| - ? "null(implicit)" |
265 |
| - : logicalTableName |
266 |
| - ), |
267 |
| - origin() |
268 |
| - ); |
269 |
| - } |
270 |
| - } |
271 |
| - return constraintSource; |
272 |
| - } |
273 |
| - |
274 |
| - private void registerUniqueKeyConstraintColumn(String constraintName, String logicalTableName, String columnName) { |
275 |
| - getOrCreateUniqueKeyConstraintSource( constraintName, logicalTableName ).addColumnName( columnName ); |
276 |
| - } |
277 |
| - |
278 |
| - private UniqueKeyConstraintSourceImpl getOrCreateUniqueKeyConstraintSource(String constraintName, String logicalTableName) { |
279 |
| - UniqueKeyConstraintSourceImpl constraintSource = (UniqueKeyConstraintSourceImpl) constraintMap.get( constraintName ); |
280 |
| - if ( constraintSource == null ) { |
281 |
| - constraintSource = new UniqueKeyConstraintSourceImpl( constraintName, logicalTableName ); |
282 |
| - constraintMap.put( constraintName, constraintSource ); |
283 |
| - } |
284 |
| - else { |
285 |
| - // make sure we have the same table name... |
286 |
| - if ( !EqualsHelper.equals( constraintSource.getTableName(), logicalTableName ) ) { |
287 |
| - throw new MappingException( |
288 |
| - String.format( |
289 |
| - Locale.ENGLISH, |
290 |
| - "Named relational unique-key [%s] referenced more than one table [%s, %s]", |
291 |
| - constraintName, |
292 |
| - constraintSource.getTableName() == null |
293 |
| - ? "null(implicit)" |
294 |
| - : constraintSource.getTableName(), |
295 |
| - logicalTableName == null |
296 |
| - ? "null(implicit)" |
297 |
| - : logicalTableName |
298 |
| - ), |
299 |
| - origin() |
300 |
| - ); |
301 |
| - } |
302 |
| - } |
303 |
| - return constraintSource; |
304 |
| - } |
305 |
| - |
306 | 228 | protected void buildAttributeSources(AttributesHelper.Callback attributeBuildingCallback) {
|
307 | 229 | AttributesHelper.processAttributes(
|
308 | 230 | sourceMappingDocument(),
|
@@ -344,22 +266,6 @@ public AttributeSourceContainer getAttributeSourceContainer() {
|
344 | 266 | public void addAttributeSource(AttributeSource attributeSource) {
|
345 | 267 | attributeSources.add( attributeSource );
|
346 | 268 | }
|
347 |
| - |
348 |
| - @Override |
349 |
| - public void registerIndexColumn( |
350 |
| - String constraintName, |
351 |
| - String logicalTableName, |
352 |
| - String columnName) { |
353 |
| - registerIndexConstraintColumn( constraintName, logicalTableName, columnName ); |
354 |
| - } |
355 |
| - |
356 |
| - @Override |
357 |
| - public void registerUniqueKeyColumn( |
358 |
| - String constraintName, |
359 |
| - String logicalTableName, |
360 |
| - String columnName) { |
361 |
| - registerUniqueKeyConstraintColumn( constraintName, logicalTableName, columnName ); |
362 |
| - } |
363 | 269 | },
|
364 | 270 | joinElement.getAttributes(),
|
365 | 271 | logicalTableName,
|
@@ -501,11 +407,6 @@ void add(SubclassEntitySourceImpl subclassEntitySource) {
|
501 | 407 | subclassEntitySources.add( subclassEntitySource );
|
502 | 408 | }
|
503 | 409 |
|
504 |
| - @Override |
505 |
| - public Collection<ConstraintSource> getConstraints() { |
506 |
| - return constraintMap.values(); |
507 |
| - } |
508 |
| - |
509 | 410 | @Override
|
510 | 411 | public Map<String,SecondaryTableSource> getSecondaryTableMap() {
|
511 | 412 | return secondaryTableMap;
|
|
0 commit comments