如何将String映射到List和List to String?
考虑一下我们跟随classess
class People{
private String primaryEmailAddress;
private String secondaryEmailAddress;
private List<String> phones;
//getter and setters
}
class PeopleTO{
private List<String> emailAddress;
private String primaryPhone;
private String secondaryPhone;
//getter and setters
}
Run Code Online (Sandbox Code Playgroud)
在Dozer和Orika中,我们可以使用以下代码行轻松映射
fields("primaryEmailAddress", "emailAddress[0]")
fields("secondaryEmailAddress", "emailAddress[1]")
fields("phones[0]", "primaryPhone")
fields("phones[1]", "secondaryPhone")
Run Code Online (Sandbox Code Playgroud)
我如何在MapStruct中进行相同类型的映射?我会在哪里找到有关mapstruct的更多示例?
在cassandra中创建表时,我们可以给出具有如下排序的聚类键.
Create table user(partitionkey int, id int, name varchar, age int, address text,
insrt_ts timestamp,
Primary key(partitionkey, name, insrt_ts, id)
with clustering order by (name asc, insrt_ts desc, id asc);
Run Code Online (Sandbox Code Playgroud)
当我们将数据插入该表时,根据cassandra文档记录基于聚类键进行排序.
当我使用CQL1和CQL2检索记录时,我得到的是相同的排序顺序.
CQL1:
Select * from user where partitionkey=101;
Run Code Online (Sandbox Code Playgroud)
CQL2:
Select * from user where partitionkey=101 order by name, insrt desc, id;
Run Code Online (Sandbox Code Playgroud)
CQL1和CQL2有什么区别?