HHH-7459 inverse attribute resolution w/ mappedBy enabled ( the Annotation case ), since from Annotation perspective, we don't have the inversed key, so, have to do the mappedBy attribute look up
This commit is contained in:
parent
845c757e07
commit
98603cce86
|
@ -49,18 +49,6 @@ public class PluralAttributeKeySourceImpl implements PluralAttributeKeySource {
|
|||
this.deleteAction = attribute.getOnDeleteAction() == OnDeleteAction.CASCADE
|
||||
? ForeignKey.ReferentialAction.CASCADE : ForeignKey.ReferentialAction.NO_ACTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RelationalValueSource> getValueSources() {
|
||||
List<RelationalValueSource> valueSources = new ArrayList<RelationalValueSource>();
|
||||
if ( !attribute.getJoinColumnValues().isEmpty() ) {
|
||||
for ( Column columnValues : attribute.getColumnValues() ) {
|
||||
valueSources.add( new ColumnSourceImpl( attribute, null, columnValues ) );
|
||||
}
|
||||
}
|
||||
return valueSources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForeignKey.ReferentialAction getOnDeleteAction() {
|
||||
return deleteAction;
|
||||
|
|
|
@ -111,7 +111,7 @@ public class JandexHelper {
|
|||
catch ( ClassCastException e ) {
|
||||
throw new AssertionFailure(
|
||||
String.format(
|
||||
"the annotation property %s of annotation %s is not of type %s",
|
||||
"the annotation property [%s] of annotation [@%s] is not of type %s",
|
||||
element,
|
||||
annotation.name(),
|
||||
type.getName()
|
||||
|
|
|
@ -148,6 +148,11 @@ public abstract class AbstractPluralAttributeSourceImpl
|
|||
return elementSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMappedBy() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String inferInLineViewName() {
|
||||
return container().getPath() + "." + pluralAttributeElement.getName();
|
||||
|
|
|
@ -81,11 +81,6 @@ public class PluralAttributeKeySourceImpl
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RelationalValueSource> getValueSources() {
|
||||
return valueSources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExplicitForeignKeyName() {
|
||||
return keyElement.getForeignKey();
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.metamodel.spi.binding;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.metamodel.spi.relational.Column;
|
||||
import org.hibernate.metamodel.spi.relational.ForeignKey;
|
||||
|
@ -43,7 +41,7 @@ public class PluralAttributeKeyBinding {
|
|||
private boolean isIncludedInUpdate;
|
||||
|
||||
// this knowledge can be implicitly resolved based on the typing information on the referenced owner attribute
|
||||
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||
private HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||
|
||||
|
||||
// todo : this would be nice to have but we do not always know it, especially in HBM case.
|
||||
|
@ -102,6 +100,10 @@ public class PluralAttributeKeyBinding {
|
|||
return hibernateTypeDescriptor;
|
||||
}
|
||||
|
||||
public void setHibernateTypeDescriptor(HibernateTypeDescriptor hibernateTypeDescriptor) {
|
||||
this.hibernateTypeDescriptor = hibernateTypeDescriptor;
|
||||
}
|
||||
|
||||
public void setForeignKey(ForeignKey foreignKey) {
|
||||
if ( foreignKey == null ) {
|
||||
throw new AssertionFailure( "foreignKey argument must be non-null." );
|
||||
|
|
|
@ -33,7 +33,5 @@ import org.hibernate.metamodel.spi.relational.ForeignKey;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface PluralAttributeKeySource extends ForeignKeyContributingSource, RelationalValueSourceContainer {
|
||||
public List<RelationalValueSource> getValueSources();
|
||||
|
||||
public ForeignKey.ReferentialAction getOnDeleteAction();
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ public interface PluralAttributeSource
|
|||
|
||||
public CustomSQL getCustomSqlDeleteAll();
|
||||
|
||||
public String getMappedBy();
|
||||
|
||||
/**
|
||||
* Describes the nature of the collection itself as declared by the metadata.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue