Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HHH-4962: Taking @OneToMany(mappedBy) Into Account #216

Closed
wants to merge 1 commit into from
Closed

HHH-4962: Taking @OneToMany(mappedBy) Into Account #216

wants to merge 1 commit into from

Conversation

systemtrap
Copy link

@AuditMappedBy can already be used to define an inverse mapping for envers.
Being unable to see any reason why standard annotations may not be taken
into account mappedBy from @OneToMany is used for an inverse @manytoone
mapping and can be overridden by @AuditMappedBy.

@AuditMappedBy can already be used to define an inverse mapping for envers.
Being unable to see any reason why standard annotations may not be taken
into account mappedBy from @OneToMany is used for an inverse @manytoone
mapping and can be overridden by @AuditMappedBy.
@lukasz-antoniak
Copy link
Member

Hi Matthias!

Thanks for submitting pull request. Don't you think that it would be more consistent if CollectionMetadataGenerator.searchMappedBy(PersistentClass, Table) method was modified as I did here: lukasz-antoniak@12464d7? Anyway, your changes to AuditedPropertiesReader and/or my to CollectionMetadataGenerator, does not make ImplicitMappedByTest test pass. IMO the type of relation presented in this JIRA issue shall be mapped as "fakeOneToManyBidirectional", and CollectionMetadataGenerator.addCollection() method needs to be adjusted. Could you investigate further?

Regards,
Lukasz Antoniak

@lukasz-antoniak
Copy link
Member

I think that I have solved this issue. Please see another commit: lukasz-antoniak@19c7a81.

The @OneToMany.mappedBy() attribute has to be read as Matthias suggests. Otherwise it is difficult to differ bi-directional relation with @jointable on the owning @manytoone side from other relations (for example OneToManyComponentTestEntity, ParentReferencingChildTest, BasicList, IdMapKey, BasicMap, BasicWhereJoinTable, ManyToManyInverseToSuperclassTest etc. tests fail) inside CollectionMetadataGenerator.addCollection() method.

Adam, if you have time please check my findings.

Regards,
Lukasz Antoniak

@adamw
Copy link
Member

adamw commented Jan 28, 2012

Ah, this is indeed a case not covered yet :)

And it must be in fact treated same as a "fake" relation. Code looks good, if the new test passes, and the old test as well, push it ;)

@lukasz-antoniak
Copy link
Member

Issue resolved. Thanks Matthias.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants