@Override
    public Object[] findIdsByColumn(String schemaName, String tableName, String pKeyName, String columnName,
            Object columnValue, Class entityClazz)
    {
        EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz);

        List<Object> primaryKeys = new ArrayList<Object>();

        DBCollection dbCollection = mongoDb.getCollection(tableName);
        BasicDBObject query = new BasicDBObject();

        query.put(columnName, MongoDBUtils.populateValue(columnValue, columnValue.getClass()));

        DBCursor cursor = dbCollection.find(query);
        KunderaCoreUtils.printQuery("Find id by column:" + query, showQuery);
        DBObject fetchedDocument = null;

        while (cursor.hasNext())
        {
            fetchedDocument = cursor.next();
            Object primaryKey = fetchedDocument.get(pKeyName);
            primaryKey = MongoDBUtils.getTranslatedObject(primaryKey, primaryKey.getClass(), metadata.getIdAttribute()
                    .getJavaType());
            primaryKeys.add(primaryKey);
        }

        if (primaryKeys != null && !primaryKeys.isEmpty())
        {
            return primaryKeys.toArray(new Object[0]);
        }
        return null;

    }
@ Override public Object [ ] findIdsByColumn ( String schemaName , String tableName , String pKeyName , String columnName , Object columnValue , Class entityClazz ) { EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClazz ) ; List < Object > primaryKeys = new ArrayList < Object > ( ) ; DBCollection dbCollection = mongoDb . getCollection ( tableName ) ; BasicDBObject query = new BasicDBObject ( ) ; query . put ( columnName , MongoDBUtils . populateValue ( columnValue , columnValue . getClass ( ) ) ) ; DBCursor cursor = dbCollection . find ( query ) ; KunderaCoreUtils . printQuery ( "Find id by column:" + query , showQuery ) ; DBObject fetchedDocument = null ; while ( cursor . hasNext ( ) ) { fetchedDocument = cursor . next ( ) ; Object primaryKey = fetchedDocument . get ( pKeyName ) ; primaryKey = MongoDBUtils . getTranslatedObject ( primaryKey , primaryKey . getClass ( ) , metadata . getIdAttribute ( ) . getJavaType ( ) ) ; primaryKeys . add ( primaryKey ) ; } if ( primaryKeys != null && ! primaryKeys . isEmpty ( ) ) { return primaryKeys . toArray ( new Object [ 0 ] ) ; } return null ; }
/*
(non-Javadoc)

@see com.impetus.kundera.client.Client#findIdsByColumn(java.lang.String,
java.lang.String, java.lang.String, java.lang.Object, java.lang.Class)