summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSebastian Schmelzer2012-09-07 12:25:49 +0200
committerSebastian Schmelzer2012-09-07 12:25:49 +0200
commit6a22a3ce71c55d7b9a6ab389c6c319b8b23f0b40 (patch)
tree15b8977a66a324988ff9cc63bad1b34e197e46e7 /src
parentuse getter for accessing entityclass (diff)
downloadxss-jpa-6a22a3ce71c55d7b9a6ab389c6c319b8b23f0b40.tar.gz
xss-jpa-6a22a3ce71c55d7b9a6ab389c6c319b8b23f0b40.tar.xz
xss-jpa-6a22a3ce71c55d7b9a6ab389c6c319b8b23f0b40.zip
wicket's IDataProvider#iterator wants to have long instead of int -> update pagination class
Diffstat (limited to 'src')
-rw-r--r--src/main/java/nu/xss/jpa/dao/GenericJpaDao.java5
-rw-r--r--src/main/java/nu/xss/jpa/query/Pagination.java16
2 files changed, 11 insertions, 10 deletions
diff --git a/src/main/java/nu/xss/jpa/dao/GenericJpaDao.java b/src/main/java/nu/xss/jpa/dao/GenericJpaDao.java
index c079f83..21a1e51 100644
--- a/src/main/java/nu/xss/jpa/dao/GenericJpaDao.java
+++ b/src/main/java/nu/xss/jpa/dao/GenericJpaDao.java
@@ -265,12 +265,13 @@ public abstract class GenericJpaDao<E extends TypedEntity<K>, K> implements
// Result pagination
TypedQuery<E> tq = getEntityManager().createQuery(q);
+ // TODO: do we need to check cast long->int?
if (pagination != null) {
if (pagination.getCount() > 0) {
- tq.setMaxResults(pagination.getOffset());
+ tq.setMaxResults((int) pagination.getOffset());
}
if (pagination.getOffset() > 0) {
- tq.setFirstResult(pagination.getCount());
+ tq.setFirstResult((int) pagination.getCount());
}
}
diff --git a/src/main/java/nu/xss/jpa/query/Pagination.java b/src/main/java/nu/xss/jpa/query/Pagination.java
index cfdd043..6fdb8ae 100644
--- a/src/main/java/nu/xss/jpa/query/Pagination.java
+++ b/src/main/java/nu/xss/jpa/query/Pagination.java
@@ -26,10 +26,10 @@ package nu.xss.jpa.query;
public class Pagination {
/** The offset. */
- private int offset = 0;
+ private long offset = 0;
/** The count. */
- private int count = 0;
+ private long count = 0;
/**
* Instantiates a new pagination.
@@ -37,7 +37,7 @@ public class Pagination {
* @param count
* the count
*/
- public Pagination(final int count) {
+ public Pagination(final long count) {
this.setCount(count);
}
@@ -49,7 +49,7 @@ public class Pagination {
* @param count
* the count
*/
- public Pagination(final int offset, final int count) {
+ public Pagination(final long offset, final long count) {
this.setOffset(offset);
this.setCount(count);
}
@@ -59,7 +59,7 @@ public class Pagination {
*
* @return the offset
*/
- public int getOffset() {
+ public long getOffset() {
return offset;
}
@@ -69,7 +69,7 @@ public class Pagination {
* @param offset
* the new offset
*/
- public void setOffset(final int offset) {
+ public void setOffset(final long offset) {
this.offset = offset;
}
@@ -78,7 +78,7 @@ public class Pagination {
*
* @return the count
*/
- public int getCount() {
+ public long getCount() {
return count;
}
@@ -88,7 +88,7 @@ public class Pagination {
* @param count
* the new count
*/
- public void setCount(final int count) {
+ public void setCount(final long count) {
this.count = count;
}