HHH-7459 fixing fail tests
This commit is contained in:
parent
68491e57a9
commit
2a3e50b400
|
@ -59,7 +59,7 @@ public class ManyToManyPluralAttributeElementSourceImpl implements ManyToManyPlu
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getReferencedColumnNames() {
|
public Collection<String> getReferencedColumnNames() {
|
||||||
HashSet<String> referencedColumnNames = new HashSet<String>();
|
HashSet<String> referencedColumnNames = new HashSet<String>();
|
||||||
for ( Column column : associationAttribute.getColumnValues() ) {
|
for ( Column column : associationAttribute.getJoinColumnValues() ) {
|
||||||
if ( column.getReferencedColumnName() != null ) {
|
if ( column.getReferencedColumnName() != null ) {
|
||||||
referencedColumnNames.add( column.getReferencedColumnName() );
|
referencedColumnNames.add( column.getReferencedColumnName() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames;
|
||||||
import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper;
|
import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper;
|
||||||
import org.hibernate.metamodel.spi.relational.Value;
|
import org.hibernate.metamodel.spi.relational.Value;
|
||||||
import org.hibernate.metamodel.spi.source.ForeignKeyContributingSource;
|
import org.hibernate.metamodel.spi.source.ForeignKeyContributingSource;
|
||||||
|
import org.hibernate.metamodel.spi.source.RelationalValueSource;
|
||||||
import org.hibernate.metamodel.spi.source.ToOneAttributeSource;
|
import org.hibernate.metamodel.spi.source.ToOneAttributeSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,6 +66,16 @@ public class ToOneAttributeSourceImpl extends SingularAttributeSourceImpl implem
|
||||||
public String getReferencedEntityName() {
|
public String getReferencedEntityName() {
|
||||||
return associationAttribute.getReferencedEntityType();
|
return associationAttribute.getReferencedEntityType();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<RelationalValueSource> relationalValueSources() {
|
||||||
|
List<RelationalValueSource> valueSources = new ArrayList<RelationalValueSource>();
|
||||||
|
if ( ! associationAttribute.getJoinColumnValues().isEmpty() ) {
|
||||||
|
for ( Column columnValues : associationAttribute.getJoinColumnValues() ) {
|
||||||
|
valueSources.add( new ColumnSourceImpl( associationAttribute, null, columnValues ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valueSources;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JoinColumnResolutionDelegate getForeignKeyTargetColumnResolutionDelegate() {
|
public JoinColumnResolutionDelegate getForeignKeyTargetColumnResolutionDelegate() {
|
||||||
|
@ -73,7 +84,7 @@ public class ToOneAttributeSourceImpl extends SingularAttributeSourceImpl implem
|
||||||
// not sure how to handle "mixed" cases either. what happens if some @JoinColumns name
|
// not sure how to handle "mixed" cases either. what happens if some @JoinColumns name
|
||||||
// a column, but others do not? For now, lets just throw an error in those cases
|
// a column, but others do not? For now, lets just throw an error in those cases
|
||||||
int alternateColumnReferences = 0;
|
int alternateColumnReferences = 0;
|
||||||
for ( Column column : associationAttribute.getColumnValues() ) {
|
for ( Column column : associationAttribute.getJoinColumnValues() ) {
|
||||||
if ( column.getReferencedColumnName() != null ) {
|
if ( column.getReferencedColumnName() != null ) {
|
||||||
alternateColumnReferences++;
|
alternateColumnReferences++;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +93,7 @@ public class ToOneAttributeSourceImpl extends SingularAttributeSourceImpl implem
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( alternateColumnReferences != associationAttribute.getColumnValues().size() ) {
|
if ( alternateColumnReferences != associationAttribute.getJoinColumnValues().size() ) {
|
||||||
throw associationAttribute.getContext().makeMappingException(
|
throw associationAttribute.getContext().makeMappingException(
|
||||||
"Encountered multiple JoinColumns mixing primary-target-columns and alternate-target-columns"
|
"Encountered multiple JoinColumns mixing primary-target-columns and alternate-target-columns"
|
||||||
);
|
);
|
||||||
|
@ -127,7 +138,7 @@ public class ToOneAttributeSourceImpl extends SingularAttributeSourceImpl implem
|
||||||
@Override
|
@Override
|
||||||
public List<Value> getJoinColumns(JoinColumnResolutionContext context) {
|
public List<Value> getJoinColumns(JoinColumnResolutionContext context) {
|
||||||
final List<Value> values = new ArrayList<Value>();
|
final List<Value> values = new ArrayList<Value>();
|
||||||
for ( Column column : associationAttribute.getColumnValues() ) {
|
for ( Column column : associationAttribute.getJoinColumnValues() ) {
|
||||||
org.hibernate.metamodel.spi.relational.Column resolvedColumn = context.resolveColumn(
|
org.hibernate.metamodel.spi.relational.Column resolvedColumn = context.resolveColumn(
|
||||||
column.getReferencedColumnName(),
|
column.getReferencedColumnName(),
|
||||||
logicalJoinTableName,
|
logicalJoinTableName,
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
/**
|
/**
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
@FailureExpectedWithNewMetamodel
|
|
||||||
public class ManyToOneReferencedColumnNameTest extends BaseCoreFunctionalTestCase {
|
public class ManyToOneReferencedColumnNameTest extends BaseCoreFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsIdentityColumns.class)
|
@RequiresDialectFeature(DialectChecks.SupportsIdentityColumns.class)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.cascade.circle;
|
package org.hibernate.test.cascade.circle;
|
||||||
|
|
||||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
|
|
Loading…
Reference in New Issue