Skip to content

Commit

Permalink
HHH-18868 Array annotated with one of @manytomany, @onetomany, or @El…
Browse files Browse the repository at this point in the history
…ementCollection should be represented with ListAttribute, not SingularAttribute
  • Loading branch information
cigaly committed Dec 2, 2024
1 parent a0b1146 commit cc1d029
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.List;

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_MANY;
import static org.hibernate.processor.util.Constants.MAP_KEY_CLASS;
Expand Down Expand Up @@ -70,7 +71,13 @@ private Types typeUtils() {

@Override
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
Expand Down

0 comments on commit cc1d029

Please sign in to comment.