
co.streamx.fluent.SQL.JoinTable Maven / Gradle / Ivy
package co.streamx.fluent.SQL;
import java.util.Collection;
import co.streamx.fluent.notation.TableJoin;
import co.streamx.fluent.notation.Tuple;
/**
* Pseudo entity simulating JoinTable in ManyToMany relationship.
*
* @param Joined Entity
* @param Inverse Joined Entity (the other side)
*/
@Tuple
public interface JoinTable {
/**
* Generates the association between the Join Table and the entity declaring the collection, i.e. in case of
*
* {@code joinBy(customer.getPhones()},
*
* the association will be between the Join Table and Customer entity. And the generated SQL may look like:
*
* {@code JOIN_TABLE.CUSTOMER_ID = CUSTOMER.ID}
*
* @param collection specifying the mapping
*/
@TableJoin
> boolean joinBy(T collection);
/**
* Use this method only in case the inverse side entity does not declare the collection. Assuming a
* many to many relationships between {@code Customer} and {@code Phone} entities. {@code Customer.getPhones()} owns
* the association, but there is no {@code Phone.getCustomer()} method. In this case the association between Join
* Table and {@code Phone} entity can be specified with this method:
*
* {@code inverseJoinBy(customer.getPhones(), phone)}
*
* @param inversedCollection inverse side entities collection
* @param inverseJoined inverse side entity
*/
@TableJoin(inverse = true)
> boolean inverseJoinBy(T inversedCollection,
INVERSE_JOINED inverseJoined);
/**
* Each row in Join Table has a foreign key (i.e. reference) to a joined and inverse joined entities. This property
* returns a {@code JOINED} entity.
*
* @return {@code JOINED} entity
*/
@TableJoin.Property
JOINED getJoined();
/**
* Each row in Join Table has a foreign key (i.e. reference) to a joined and inverse joined entities. This property
* returns a {@code INVERSE_JOINED} entity.
*
* @return {@code INVERSE_JOINED} entity
*/
@TableJoin.Property(inverse = true)
INVERSE_JOINED getInverseJoined();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy