Skip to content

Conversation

@dreab8
Copy link
Member

@dreab8 dreab8 commented Mar 18, 2024

in case of

public @interface JoinTable {
   ....
    ForeignKey inverseForeignKey() default @ForeignKey(ConstraintMode.PROVIDER_DEFAULT);
  ...
}

the value returned by getAttributeMethod().getDefaultValue() is an instance of Annotation, so we need to convert it in a DynaicAnnotationUsage.

When the default value is a multi value

JoinColumn[] joinColumns() default {};

the value returned by getAttributeMethod().getDefaultValue() is an array but we later try to acces it as a list,
List<E> AttributeUsage#getList(String name);

@dreab8 dreab8 force-pushed the fix_default_value_extraction branch from 0144a6d to 3ce1570 Compare March 18, 2024 12:04
@dreab8 dreab8 marked this pull request as draft March 18, 2024 12:37
@dreab8
Copy link
Member Author

dreab8 commented Mar 18, 2024

it seems Arrays.asList( defaultValue ) is not the correct way to convert array default values to a list, it causes an UnsupportException when trying to add a new element to the list.

@dreab8 dreab8 force-pushed the fix_default_value_extraction branch from 3ce1570 to 5c8f3ee Compare March 18, 2024 16:01
@dreab8 dreab8 marked this pull request as ready for review March 18, 2024 16:02
@dreab8 dreab8 requested review from mbellade and sebersole March 18, 2024 16:02
Copy link
Member

@mbellade mbellade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just left a couple comments!

Copy link
Member

@sebersole sebersole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good.

@sebersole sebersole added this to the 0.7.0 milestone Mar 18, 2024
@dreab8 dreab8 force-pushed the fix_default_value_extraction branch from 5c8f3ee to 1a3ee72 Compare March 18, 2024 16:30
@dreab8 dreab8 force-pushed the fix_default_value_extraction branch from 1a3ee72 to d7f63c8 Compare March 18, 2024 16:52
@sebersole sebersole merged commit 2eda68f into hibernate:main Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants