A DAO is an interface that defines a set of query methods. In general, those queries will relate to the same entity (although that is not a requirement).
It must be annotated with @Dao:
@Dao
public interface ProductDao {
@Select
Product findById(UUID productId);
@Insert
void save(Product product);
@Delete
void delete(Product product);
}To add queries, define methods on your interface and mark them with one of the following annotations:
The methods can have any name. The allowed parameters and return type are specific to each annotation.
To obtain a DAO instance, use a factory method on the mapper interface.
InventoryMapper inventoryMapper = new InventoryMapperBuilder(session).build();
ProductDao dao = inventoryMapper.productDao("someKeyspace");The returned object is thread-safe, and can securely be shared throughout your application.