Change rowCount on LazyDataModel to long

UI Components for JSF
Post Reply
javahippie
Posts: 1
Joined: 01 Oct 2015, 09:34

01 Oct 2015, 09:53

Hi,

I do realize that there is an old thread with a similar topic, but I also think reviving it would do nothing good. (http://forum.primefaces.org/viewtopic.php?f=3&t=24072 -> for reference). My post relates to Primefaces 5.2.

It will rarely be the case, that the rowcount of a table will exceed the range of int, and I think it would be bad practice to have a LazyDataModel and a pageable datatable on such a table. But we also know, that developers have limited control over these facts.

More important, most database drivers and persistence frameworks (JPA first) will return a long primitive on 'count' methods. If we want to use LazyDataModel with these libraries, we have to cast every result to int. On one hand, this is an inconvenience for the developer, but also my opinion is that casting long to int is always a code smell, as you can never be sure it will work forever. It is dangerous (I know, this is very theoretical and might be really rare in 'real life').

Changing the field from int to long should not be a breaking change, because it is a widening primitive conversion and will be performed implicitly.

Best regards
javahippie

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests