Database Reference
In-Depth Information
.mapper(Blog.class)
.get(blogUUID);
You can execute any arbitrary queries and map it to an object. To do that, you will have to
write an interface that contains a method signature of what the query consumes as its ar-
gument and what it returns as the method return type, as follows:
@Accessor
public interface AllQueries {
[--snip--]
@Query("SELECT * FROM " + Constants.KEYSPACE + ".blogs
WHERE blog_name = :blogName")
public Result<Blog> getBlogByName(@Param("blogName")
String blogName);
[-- snip --]
Tip
This interface is annotated with Accessor , and it has methods that basically satisfy the
Query annotation that it carries. The snippet of the Blog class uses this method to re-
trieve the names blog by blog.
Search WWH ::




Custom Search