microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/TableGettingStartedTask.java
public void BasicUpsert() throws StorageException {
        // Retrieve the entity with partition key of "Smith" and row key of
        // "Jeff".
        TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith",
                "Jeff", CustomerEntity.class);

        // Submit the operation to the table service and get the specific
        // entity.
        CustomerEntity specificEntity = table.execute(retrieveSmithJeff)
                .getResultAsType();

        // Specify a new phone number.
        specificEntity.setPhoneNumber("425-555-0105");

        // Create an operation to replace the entity.
        TableOperation replaceEntity = TableOperation.merge(specificEntity);

        // Submit the operation to the table service.
        table.execute(replaceEntity);
    }
public void BasicUpsert() throws StorageException {
        // Retrieve the entity with partition key of "Smith" and row key of
        // "Jeff".
        TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith",
                "Jeff", CustomerEntity.class);

        // Submit the operation to the table service and get the specific
        // entity.
        CustomerEntity specificEntity = table.execute(retrieveSmithJeff)
                .getResultAsType();

        // Specify a new phone number.
        specificEntity.setPhoneNumber("425-555-0105");

        // Create an operation to replace the entity.
        TableOperation replaceEntity = TableOperation.merge(specificEntity);

        // Submit the operation to the table service.
        table.execute(replaceEntity);
    }
Illustrates how to form and execute an upsert operation.

@throws StorageException