HHH-18868 Array annotated with one of @ManyToMany, @OneToMany, or @ElementCollection should be represented with ListAttribute, not SingularAttribute
This commit is contained in:
parent
212d4b676e
commit
a38a300a32
|
@ -27,6 +27,7 @@ import javax.tools.Diagnostic;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.hibernate.processor.util.Constants.ELEMENT_COLLECTION;
|
import static org.hibernate.processor.util.Constants.ELEMENT_COLLECTION;
|
||||||
|
import static org.hibernate.processor.util.Constants.LIST_ATTRIBUTE;
|
||||||
import static org.hibernate.processor.util.Constants.MANY_TO_ANY;
|
import static org.hibernate.processor.util.Constants.MANY_TO_ANY;
|
||||||
import static org.hibernate.processor.util.Constants.MANY_TO_MANY;
|
import static org.hibernate.processor.util.Constants.MANY_TO_MANY;
|
||||||
import static org.hibernate.processor.util.Constants.MAP_KEY_CLASS;
|
import static org.hibernate.processor.util.Constants.MAP_KEY_CLASS;
|
||||||
|
@ -70,7 +71,13 @@ public class MetaAttributeGenerationVisitor extends SimpleTypeVisitor8<@Nullable
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable AnnotationMetaAttribute visitArray(ArrayType arrayType, Element element) {
|
public @Nullable AnnotationMetaAttribute visitArray(ArrayType arrayType, Element element) {
|
||||||
return new AnnotationMetaSingleAttribute( entity, element, toArrayTypeString( arrayType, context ) );
|
if ( hasAnnotation( element, MANY_TO_MANY, ONE_TO_MANY, ELEMENT_COLLECTION ) ) {
|
||||||
|
return new AnnotationMetaCollection( entity, element, LIST_ATTRIBUTE,
|
||||||
|
toTypeString(arrayType.getComponentType()) );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return new AnnotationMetaSingleAttribute( entity, element, toArrayTypeString( arrayType, context ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue