Zhong Hao (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYWI5MzNmZTgw...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16527?atlOrigin=eyJpIjoiYWI5Mz...
) HHH-16527 (
https://hibernate.atlassian.net/browse/HHH-16527?atlOrigin=eyJpIjoiYWI5Mz...
).CollectionBinder.bindManytoManyInverseFk does not handling exceptions. (
https://hibernate.atlassian.net/browse/HHH-16527?atlOrigin=eyJpIjoiYWI5Mz...
)
Issue Type: Bug Affects Versions: 6.2.1 Assignee: Unassigned Components: hibernate-core
Created: 26/Apr/2023 23:23 PM Environment:
Priority: Major Reporter: Zhong Hao (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
.CollectionBinder.bindManytoManyInverseFk has the following code:
public static void bindManytoManyInverseFk(PersistentClass referencedEntity,
Ejb3JoinColumn[] columns,
SimpleValue value,
boolean unique,
MetadataBuildingContext buildingContext) {
...
final Property property = referencedEntity.getRecursiveProperty( mappedBy );
..
}
The referencedEntity.getRecursiveProperty can throw MappingException. The other method of
this class catches and rethrows AnnotationException:
protected boolean bindStarToManySecondPass(
Map<String, PersistentClass> persistentClasses,
XClass collType,
Ejb3JoinColumn[] fkJoinColumns,
Ejb3JoinColumn[] keyColumns,
Ejb3JoinColumn[] inverseColumns,
Ejb3Column[] elementColumns,
boolean isEmbedded,
XProperty property,
boolean unique,
TableBinder associationTableBinder,
boolean ignoreNotFound,
MetadataBuildingContext buildingContext) {
...
try {
reversePropertyInJoin = 0 != persistentClass.getJoinNumber(
persistentClass.getRecursiveProperty( this.mappedBy )
);
}
catch (MappingException e) {
throw new AnnotationException(
"mappedBy reference an unknown target entity property: " +
collType + "." + this.mappedBy +
" in " +
collection.getOwnerEntityName() +
"." +
property.getName()
);
}
...
}
As a result, the same type of errors can cause different types of exceptions. It would
confuse programmers.
Catching AnnotationException can fail to handle the same errors in
bindManytoManyInverseFk.
Can this problem be fixed?
(
https://hibernate.atlassian.net/browse/HHH-16527#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16527#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100223- sha1:02266b8 )