As the title say, I want to know the differences among these two methods.
Specifically I want to know the difference between:
join(String arg) AND joinSet(String arg)
As I can use join(String arg) even if the attribute is a Set, but not the opposite, namely using joinSet(String arg) on an attribute that is not a Set.
Thanks.
The join method is used to create an inner join on a single attribute i.e. a one to one relationship.
/*Create an inner join to the specified single-valued attribute.
Parameters:
attribute target of the join
Returns:
the resulting join*/
74
75 <Y> Join<X, Y> More ...join(SingularAttribute<? super X, Y> attribute);
While the method joinSet is used to create an inner join for a set of attribtues, i.e. a one to many relationship.
/*Create an inner join to the specified Set-valued attribute.
Parameters:
attributeName name of the attribute for the target of the join
Returns:
the resulting join
Throws:
java.lang.IllegalArgumentException if attribute of the given name does not exist*/
182
183 <X, Y> SetJoin<X, Y> More ...joinSet(String attributeName);
However, if you look at the return types of the methods, join returns type Join and joinSet returns type SetJoin, which implements Join. This means that it would be entirely possible for the implementing application to put in some logic that detects if you are trying to join a set or single attribute and forward the process onto the joinSet method if necessary. Without knownig what implementation you are using, I cant really comment much further on that.
Source code found on grep code here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With