Package org.datanucleus.store.rdbms.key

Examples of org.datanucleus.store.rdbms.key.Index


        Set indices = super.getExpectedIndices(clr);

        // Check owner for specified indices
        if (mmd.getIndexMetaData() != null)
        {
            Index index = TableUtils.getIndexForField(this, mmd.getIndexMetaData(), ownerMapping);
            if (index != null)
            {
                indices.add(index);
            }
        }
        else if (mmd.getJoinMetaData() != null && mmd.getJoinMetaData().getIndexMetaData() != null)
        {
            Index index = TableUtils.getIndexForField(this, mmd.getJoinMetaData().getIndexMetaData(), ownerMapping);
            if (index != null)
            {
                indices.add(index);
            }
        }

        // Check element for specified indices
        if (elementMapping instanceof EmbeddedElementPCMapping)
        {
            // Add all indices required by fields of the embedded element
            EmbeddedElementPCMapping embMapping = (EmbeddedElementPCMapping)elementMapping;
            for (int i=0;i<embMapping.getNumberOfJavaTypeMappings();i++)
            {
                // Add indexes for fields of this embedded PC object
                JavaTypeMapping embFieldMapping = embMapping.getJavaTypeMapping(i);
                IndexMetaData imd = embFieldMapping.getMemberMetaData().getIndexMetaData();
                if (imd != null)
                {
                    Index index = TableUtils.getIndexForField(this, imd, embFieldMapping);
                    if (index != null)
                    {
                        indices.add(index);
                    }
                }
            }
        }
        else
        {
            ElementMetaData elemmd = mmd.getElementMetaData();
            if (elemmd != null && elemmd.getIndexMetaData() != null)
            {
                Index index = TableUtils.getIndexForField(this, elemmd.getIndexMetaData(), elementMapping);
                if (index != null)
                {
                    indices.add(index);
                }
            }
        }

        // Check order for specified indices
        if (orderMapping != null)
        {
            if (mmd.getOrderMetaData() != null && mmd.getOrderMetaData().getIndexMetaData() != null)
            {
                Index index = TableUtils.getIndexForField(this, mmd.getOrderMetaData().getIndexMetaData(), orderMapping);
                if (index != null)
                {
                    indices.add(index);
                }
            }
View Full Code Here


     * @param factory Identifier factory
     * @return The text of the SQL statement.
     */
    public String getAddCandidateKeyStatement(CandidateKey ck, IdentifierFactory factory)
    {
        Index idx = new Index(ck);
        idx.setName(ck.getName());
        return getCreateIndexStatement(idx, factory);
    }
View Full Code Here

        return "ALTER TABLE " + pk.getDatastoreContainerObject().toString() + " ADD " + pk;
    }

    public String getAddCandidateKeyStatement(CandidateKey ck, IdentifierFactory factory)
    {
        Index idx = new Index(ck);
        idx.setName(ck.getName());
        return getCreateIndexStatement(idx, factory);
    }
View Full Code Here

TOP

Related Classes of org.datanucleus.store.rdbms.key.Index

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.