Can i use "LIMIT" keyword in JPQL when using cassandra
Can i use "LIMIT" keyword in JPQL when using cassandra ? as you know CQL can use it now.
LIMIT keyword is not supported as of now, but there are two ways we can achieve this:
- Using query.setMaxResults(n);
- Running your CQL (native query) directly by:
Query q = entityManager.createNativeQuery("My CQL Query String",
MyEntity.class);
List
Regards, Amresh
On Tue, Jan 22, 2013 at 11:12 AM, zhouhero [email protected] wrote:
Can i use "LIMIT" keyword in JPQL when using cassandra ? as you know CQL can use it now.
— Reply to this email directly or view it on GitHubhttps://github.com/impetus-opensource/Kundera/issues/160.
by the way, when not do setMaxResults, by default , how many records are return? ※cassandra can return 10,000 records by default.
Default is 100 if you not set it. This is consistent with thrift behavior and Cassandra-cli.
CQL command line returns 10000 results.
Amresh
On Tue, Jan 22, 2013 at 11:21 AM, zhouhero [email protected] wrote:
by the way, when not do setMaxResults, by default , how many records are return? ※cassandra can return 10,000 records by default.
— Reply to this email directly or view it on GitHubhttps://github.com/impetus-opensource/Kundera/issues/160#issuecomment-12531628.
thank you very much! let me try it.
by the way, Are setFirstResult, setMaxResults implemented? how can i do paging by using kundera?
my db is cassandra.
Pagination support is not yet supported. Cassandra does not offer a way to build cursor like support on db side. Loading everything in-memory and providing implementing custom iterator is possible and we are working on it. But it is going to have extensive memory usage. Also range queries are possible only over OrderedPartitioner(not recommented by casandra), We are planning to build this in future releases.
setFirstResult will make sense once pagination is in place. Alternative way is to fetch first record from returned list of matching results.
-Vivek
i see, thank you very much! by the way , when kundera 2.3 release? i have heard that it will be released in this weekend by planning.
Releasing on 24th.
-Vivek
it's perfect!!! Thanks!