|
24 | 24 | package org.hibernate.loader.plan2.build.internal.returns;
|
25 | 25 |
|
26 | 26 | import org.hibernate.engine.FetchStrategy;
|
| 27 | +import org.hibernate.loader.PropertyPath; |
27 | 28 | import org.hibernate.loader.plan2.build.spi.ExpandingFetchSource;
|
28 | 29 | import org.hibernate.loader.plan2.spi.BidirectionalEntityFetch;
|
| 30 | +import org.hibernate.loader.plan2.spi.EntityFetch; |
| 31 | +import org.hibernate.loader.plan2.spi.EntityIdentifierDescription; |
29 | 32 | import org.hibernate.loader.plan2.spi.EntityReference;
|
30 |
| -import org.hibernate.loader.plan2.spi.Join; |
| 33 | +import org.hibernate.loader.plan2.spi.Fetch; |
| 34 | +import org.hibernate.loader.plan2.spi.FetchSource; |
| 35 | +import org.hibernate.persister.entity.EntityPersister; |
31 | 36 | import org.hibernate.persister.walking.spi.AssociationAttributeDefinition;
|
| 37 | +import org.hibernate.type.EntityType; |
32 | 38 |
|
33 | 39 | /**
|
34 | 40 | * Represents an entity fetch that is bi-directionally join fetched.
|
|
39 | 45 | *
|
40 | 46 | * @author Steve Ebersole
|
41 | 47 | */
|
42 |
| -public class BidirectionalEntityFetchImpl extends EntityFetchImpl implements BidirectionalEntityFetch { |
| 48 | +public class BidirectionalEntityFetchImpl implements BidirectionalEntityFetch, EntityFetch { |
| 49 | + private final ExpandingFetchSource fetchSource; |
| 50 | + private final AssociationAttributeDefinition fetchedAttribute; |
| 51 | + private final FetchStrategy fetchStrategy; |
43 | 52 | private final EntityReference targetEntityReference;
|
| 53 | + private final PropertyPath propertyPath; |
44 | 54 |
|
45 | 55 | public BidirectionalEntityFetchImpl(
|
46 | 56 | ExpandingFetchSource fetchSource,
|
47 | 57 | AssociationAttributeDefinition fetchedAttribute,
|
48 | 58 | FetchStrategy fetchStrategy,
|
49 |
| - Join fetchedJoin, |
50 | 59 | EntityReference targetEntityReference) {
|
51 |
| - super( fetchSource, fetchedAttribute, fetchStrategy, fetchedJoin ); |
| 60 | + this.fetchSource = fetchSource; |
| 61 | + this.fetchedAttribute = fetchedAttribute; |
| 62 | + this.fetchStrategy = fetchStrategy; |
52 | 63 | this.targetEntityReference = targetEntityReference;
|
| 64 | + this.propertyPath = fetchSource.getPropertyPath().append( fetchedAttribute.getName() ); |
53 | 65 | }
|
54 | 66 |
|
55 | 67 | public EntityReference getTargetEntityReference() {
|
56 | 68 | return targetEntityReference;
|
57 | 69 | }
|
| 70 | + |
| 71 | + @Override |
| 72 | + public FetchSource getSource() { |
| 73 | + return fetchSource; |
| 74 | + } |
| 75 | + |
| 76 | + @Override |
| 77 | + public PropertyPath getPropertyPath() { |
| 78 | + return propertyPath; |
| 79 | + } |
| 80 | + |
| 81 | + @Override |
| 82 | + public FetchStrategy getFetchStrategy() { |
| 83 | + return fetchStrategy; |
| 84 | + } |
| 85 | + |
| 86 | + @Override |
| 87 | + public EntityType getFetchedType() { |
| 88 | + return (EntityType) fetchedAttribute.getType(); |
| 89 | + } |
| 90 | + |
| 91 | + @Override |
| 92 | + public boolean isNullable() { |
| 93 | + return fetchedAttribute.isNullable(); |
| 94 | + } |
| 95 | + |
| 96 | + @Override |
| 97 | + public String getAdditionalJoinConditions() { |
| 98 | + return null; //To change body of implemented methods use File | Settings | File Templates. |
| 99 | + } |
| 100 | + |
| 101 | + @Override |
| 102 | + public String[] toSqlSelectFragments(String alias) { |
| 103 | + return new String[0]; //To change body of implemented methods use File | Settings | File Templates. |
| 104 | + } |
| 105 | + |
| 106 | + @Override |
| 107 | + public String getQuerySpaceUid() { |
| 108 | + return targetEntityReference.getQuerySpaceUid(); |
| 109 | + } |
| 110 | + |
| 111 | + @Override |
| 112 | + public Fetch[] getFetches() { |
| 113 | + return FetchSource.NO_FETCHES; |
| 114 | + } |
| 115 | + |
| 116 | + @Override |
| 117 | + public EntityReference resolveEntityReference() { |
| 118 | + return this; |
| 119 | + } |
| 120 | + |
| 121 | + @Override |
| 122 | + public EntityPersister getEntityPersister() { |
| 123 | + return targetEntityReference.getEntityPersister(); |
| 124 | + } |
| 125 | + |
| 126 | + @Override |
| 127 | + public EntityIdentifierDescription getIdentifierDescription() { |
| 128 | + return targetEntityReference.getIdentifierDescription(); |
| 129 | + } |
58 | 130 | }
|
0 commit comments