-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from adutra/more-enhancements
More enhancements :-)
- Loading branch information
Showing
8 changed files
with
54 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 11 additions & 16 deletions
27
src/main/java/com/datastax/examples/order/OrderRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,28 @@ | ||
package com.datastax.examples.order; | ||
|
||
import org.springframework.data.cassandra.repository.CassandraRepository; | ||
import org.springframework.data.cassandra.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.data.rest.core.annotation.RepositoryRestResource; | ||
|
||
import org.springframework.data.rest.core.annotation.RestResource; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@RepositoryRestResource(collectionResourceRel = "orders", path = "orders") | ||
@Repository | ||
@RestResource(exported = false) | ||
public interface OrderRepository extends CassandraRepository<Order, OrderPrimaryKey> { | ||
|
||
@RestResource(exported = false) | ||
void deleteByKeyOrderId(UUID orderId); | ||
// DELETE | ||
|
||
void deleteByKeyOrderId(UUID orderId); | ||
|
||
@RestResource(exported = false) | ||
void deleteByKeyOrderIdAndKeyProductId(UUID orderId, UUID productId); | ||
void deleteByKeyOrderIdAndKeyProductId(UUID orderId, UUID productId); | ||
|
||
@RestResource(path="name-and-price-only") | ||
@Query("SELECT product_name, product_price FROM orders WHERE order_id = :orderId") | ||
List<Order> findProductNamesAndPricesFromOrder(@Param("orderId") UUID orderId); | ||
// FIND (all projected) | ||
|
||
@RestResource(exported = false) | ||
List<Order> findByKeyOrderId(UUID orderId); | ||
ProductNameAndPrice findByKeyOrderIdAndKeyProductId(UUID orderId, UUID productId); | ||
|
||
@RestResource(exported = false) | ||
Order findByKeyOrderIdAndKeyProductId(UUID orderId, UUID productId); | ||
List<ProductNameAndPrice> findByKeyOrderId(UUID orderId); | ||
|
||
List<ProductNameAndPrice> findAllProjectedBy(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters