Package com.impetus.kundera.metadata.model

Examples of com.impetus.kundera.metadata.model.JoinTableMetadata


                    }
                }
                // if relation type is many to many and relation via join table.
                else if ((relationType.equals(ForeignKey.MANY_TO_MANY)) && (entityMetadata.isRelationViaJoinTable()))
                {
                    JoinTableMetadata joinTableMetadata = relation.getJoinTableMetadata();
                    String joinTableName = joinTableMetadata != null ? joinTableMetadata.getJoinTableName() : null;
                    String joinColumnName = joinTableMetadata != null ? (String) joinTableMetadata.getJoinColumns()
                            .toArray()[0] : null;
                    String inverseJoinColumnName = joinTableMetadata != null ? (String) joinTableMetadata
                            .getInverseJoinColumns().toArray()[0] : null;
                    if (joinTableName != null)
                    {
                        TableInfo joinTableInfo = new TableInfo(joinTableName, Type.COLUMN_FAMILY.name(), String.class,
                                "key");
View Full Code Here




        if (isJoinedByTable)
        {
            JoinTableMetadata jtMetadata = new JoinTableMetadata(relationField);

            relation.setRelatedViaJoinTable(true);
            relation.setJoinTableMetadata(jtMetadata);
        }
View Full Code Here

                        // M-2-M relation fields that are Set or List are joined
                        // by join table.
                        // M-2-M relation fields that are Map aren't joined by
                        // Join table

                        JoinTableMetadata jtmd = (JoinTableMetadata) nodeLink
                                .getLinkProperty(LinkProperty.JOIN_TABLE_METADATA);
                        if (jtmd != null)
                        {
                            String joinColumnName = (String) jtmd.getJoinColumns().toArray()[0];
                            String inverseJoinColumnName = (String) jtmd.getInverseJoinColumns().toArray()[0];
                            Object entityId = node.getEntityId();
                            Object childId = childNode.getEntityId();
                            Set<Object> childValues = new HashSet<Object>();
                            childValues.add(childId);

                            OPERATION operation = null;
                            if (node.getCurrentNodeState().getClass().equals(ManagedState.class))
                            {
                                operation = OPERATION.INSERT;
                            }
                            else if (node.getCurrentNodeState().getClass().equals(RemovedState.class))
                            {
                                operation = OPERATION.DELETE;
                            }

                            addJoinTableData(operation, jtmd.getJoinTableSchema(), jtmd.getJoinTableName(),
                                    joinColumnName, inverseJoinColumnName, node.getDataClass(), entityId, childValues);
                        }
                    }

                    // Process child node Graph recursively first
View Full Code Here

     * {@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);
View Full Code Here

TOP

Related Classes of com.impetus.kundera.metadata.model.JoinTableMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.