You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Andrei Arapov (JIRA)" <ji...@apache.org> on 2012/07/09 11:01:37 UTC

[jira] [Commented] (TAP5-1971) HibernateGridDataSource should include some workaround or protection agains wrong Projections.rowCount() result

    [ https://issues.apache.org/jira/browse/TAP5-1971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13409275#comment-13409275 ] 

Andrei Arapov commented on TAP5-1971:
-------------------------------------

Simplest and stupid workaround is to override getRowValue() method:

            @Override
            public Object getRowValue(int index) {
                try {
                    return super.getRowValue(index);
                } catch (Exception e) {
                    log.error(e.getMessage());
                    return null;
                }
            }

                
> HibernateGridDataSource should include some workaround or protection agains wrong Projections.rowCount() result
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1971
>                 URL: https://issues.apache.org/jira/browse/TAP5-1971
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-hibernate
>    Affects Versions: 5.3.3
>            Reporter: Andrei Arapov
>            Priority: Critical
>
> In some cases Hibernate's criteria construction like "criteria.setProjection(Projections.rowCount())" returns wrong number of rows. More specifically, for example, if you have some JPA restrictions in you entity annotations (e.g. 
> "   @ManyToOne
>     @JoinColumn(name = "USER_ID", nullable = false)  <---- this one!
>     @NonVisual
>     public UserImpl user; ")
> then such restrictions (for USER_ID is not null) will not be taken in account while building "row-count" query.
> Vice-versa hibernate will use such restrictions in query for getting LIST of entities.
> This behaivour fails, when in entity table appear (e.g. some old) rows with NULL in "USER_ID" (e.g.) columns.
> This is known, but not solved problem for Hibernate, see:
> https://hibernate.onjira.com/browse/HHH-3238
> https://hibernate.onjira.com/browse/HHH-2787
> https://hibernate.onjira.com/browse/HHH-3206
> https://hibernate.onjira.com/browse/HHH-5719
> https://hibernate.onjira.com/browse/HHH-4829
> https://hibernate.onjira.com/browse/HHH-7438
> There by we go into error in HibernateGridDataSource.getRowValue(int index) method: it throws IndexOutOfBoundsException due to row count number is bigger than actual number of selected rows.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira