* {@link Set} or {@link List})
*/
private void populateCollectionFromJoinTable(Object entity, EntityMetadata entityMetadata,
PersistenceDelegator delegator, Relation relation)
{
JoinTableMetadata jtMetadata = relation.getJoinTableMetadata();
Client pClient = delegator.getClient(entityMetadata);
String schema = entityMetadata.getSchema();
EntityMetadata owningEntityMetadata = KunderaMetadataManager.getEntityMetadata(delegator.getKunderaMetadata(),
relation.getTargetEntity());
Class columnJavaType = owningEntityMetadata.getIdAttribute().getJavaType();
if (jtMetadata == null)
{
columnJavaType = entityMetadata.getIdAttribute().getJavaType();
Relation owningEntityMetadataRelation = owningEntityMetadata.getRelation(relation.getMappedBy());
jtMetadata = owningEntityMetadataRelation.getJoinTableMetadata();
pClient = delegator.getClient(owningEntityMetadata);
schema = owningEntityMetadata.getSchema();
}
String joinTableName = jtMetadata.getJoinTableName();
Set<String> joinColumns = jtMetadata.getJoinColumns();
Set<String> inverseJoinColumns = jtMetadata.getInverseJoinColumns();
String joinColumnName = (String) joinColumns.toArray()[0];
String inverseJoinColumnName = (String) inverseJoinColumns.toArray()[0];
Object entityId = PropertyAccessorHelper.getId(entity, entityMetadata);