You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Arturo Perez <ap...@hayesinc.com> on 2006/06/07 22:10:29 UTC

setPageSize causes blowup?

Using 1.2beta if I set the page size of a query to a number larger than 
the result set then an exception is being thrown.

Now, this seems to be a bit of a catch 22 because I don't know
how many items will be returned in general.

Here's the stack trace.

org.objectstyle.cayenne.CayenneRuntimeException: 
[v.1.2B2 April 17 2006] 
Error performing query.
	at
org.objectstyle.cayenne.access.IncrementalFaultList.
fillIn(IncrementalFaultList.java:265)
	at
org.objectstyle.cayenne.access.IncrementalFaultList.<init>
(IncrementalFaultList.java:192)
	at
org.objectstyle.cayenne.access.DataContextQueryAction.
interceptPaginatedQuery
(DataContextQueryAction.java:128)
	at
org.objectstyle.cayenne.access.DataContextQueryAction.execute
(DataContextQueryAction.java:86)
	at org.objectstyle.cayenne.access.DataContext.
onQuery(DataContext.java:1331)
	at org.objectstyle.cayenne.access.DataContext.
performQuery(DataContext.java:1320)



Caused by: java.sql.SQLException: Operation not allowed after ResultSet closed
	at com.mysql.jdbc.ResultSet.checkClosed(ResultSet.java:639)
	at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:677)
	at com.mysql.jdbc.ResultSet.getNativeString(ResultSet.java:4000)
	at com.mysql.jdbc.ResultSet.getStringInternal(ResultSet.java:5153)
	at com.mysql.jdbc.ResultSet.getString(ResultSet.java:4999)
	at
org.apache.commons.dbcp.DelegatingResultSet.getString
(DelegatingResultSet.java:174)
	at
org.objectstyle.cayenne.access.types.CharType.materializeObject
(CharType.java:152)
	at
org.objectstyle.cayenne.access.jdbc.JDBCResultIterator.readDataRow
(JDBCResultIterator.java:305)
	at
org.objectstyle.cayenne.access.jdbc.JDBCResultIterator.nextDataRow
(JDBCResultIterator.java:163)
	at
org.objectstyle.cayenne.access.IncrementalFaultList.fillIn
(IncrementalFaultList.java:236)



Re: Re: setPageSize causes blowup?

Posted by Michael Gentry <bl...@gmail.com>.
I'm using Cayenne with Tapestry (3&4) with pretty good success.  The
Tapestry learning curve is pretty steep (and harder if you expect it
to be a WebObjects clone, which it isn't), but I think it is quite a
bit better than Struts.  In your HTML template, you can have things
like:

<input type="checkbox" jwcid="@Checkbox" value="ognl:isEarlyFundingEligible"/>

Tapestry will automatically call getIsEarlyFundingEligible() in your
Java class on presenting the page, and also automatically call
setIsEarlyFundingEligible(value) when processing the form.  Tapestry
also allows key paths there, something like:
ognl:myCayenneObject.foo.bar.name and it'll call the right get/set for
you and Cayenne can persist it automatically.  My update method, to
process the form submission for an entire table of data values, is:

  public void update()
  {
    getSession().getDataContext().commitChanges();
  }

That is just what you would expect from WebObjects, too.  There are a
lot of similarities between WebObjects and Tapestry/Cayenne, but it
isn't a 100% feature clone, so keep that in mind (Cayenne is closer to
EOF than Tapestry is to WO).

/dev/mrg


On 6/8/06, Arturo Perez <ap...@hayesinc.com> wrote:
>
> Actually, it's not Cayenne that makes me miss WebObjects.  I think it's doing a
> find job as an EOF-ng.
>
> What's getting me down is all the data translation between the Struts-based
> front end (strings?  integers?  what happened to my OBJECTS!?) and the
> business logic layer.
>
> Now, I'm updating a Neanderthalish Web application so I don't have the
> complete freedom to switch to something else.  Click sounds intriguing.
>
> Any other recommendations for in-house Web application front-end development
> that plays nicely with Cayenne?
>
> -arturo

Re: Re: setPageSize causes blowup?

Posted by Arturo Perez <ap...@hayesinc.com>.
Gentry, Michael (Contractor <michael_gentry <at> fanniemae.com> writes:

> 
> Cayenne does some things a bit easier than EOF.  Such as automatically
> reconnecting to your database when the connection has been lost and
> automatically opening new database connections for multithreaded
> operations.  I'm also fond of the dual-class generation, like
> EOGenerator gave.  Still amazed Apple never built that into EOModeler or
> bundled it ...
> 
> /dev/mrg
> 
> -----Original Message-----
> From: news [mailto:news <at> sea.gmane.org] On Behalf Of Arturo Perez
> Sent: Thursday, June 08, 2006 9:47 AM
> To: cayenne-user <at> incubator.apache.org
> Subject: Re: setPageSize causes blowup?
> 
> Andrus Adamchik <andrus <at> objectstyle.org> writes:
> 
> > 
> > I couldn't reproduce the problem with the latest version of Cayenne.  
> > Could you possibly upgrade to RC1 and see if this is still broken?
> > 
> > Andrus
> > 
> 
> That was my plan and I tried it this morning.  Seems to work fine.
> 
> Thanks!  I'm loving this almost as much as I loved WebObjects.
> 
> -arturo
> 
> 

Actually, it's not Cayenne that makes me miss WebObjects.  I think it's doing a
find job as an EOF-ng.

What's getting me down is all the data translation between the Struts-based
front end (strings?  integers?  what happened to my OBJECTS!?) and the
business logic layer.

Now, I'm updating a Neanderthalish Web application so I don't have the
complete freedom to switch to something else.  Click sounds intriguing.

Any other recommendations for in-house Web application front-end development
that plays nicely with Cayenne?

-arturo





Re: setPageSize causes blowup?

Posted by Arturo Perez <ap...@hayesinc.com>.
Andrus Adamchik <andrus <at> objectstyle.org> writes:

> 
> I couldn't reproduce the problem with the latest version of Cayenne.  
> Could you possibly upgrade to RC1 and see if this is still broken?
> 
> Andrus
> 

That was my plan and I tried it this morning.  Seems to work fine.

Thanks!  I'm loving this almost as much as I loved WebObjects.

-arturo





Re: setPageSize causes blowup?

Posted by Andrus Adamchik <an...@objectstyle.org>.
I couldn't reproduce the problem with the latest version of Cayenne.  
Could you possibly upgrade to RC1 and see if this is still broken?

Andrus

On Jun 8, 2006, at 1:45 AM, Arturo Perez wrote:

> Gentry, Michael (Contractor <michael_gentry <at> fanniemae.com>  
> writes:
>
>>
>> Are you calling setPageSize() before or after the performQuery()?
>
> The code snippet is
>
> 		SelectQuery sq = new SelectQuery(XXX.class);
> 		sq.setPageSize(ListSelectPager.LIST_SELECT_PAGE_SIZE);
> 		return DataContext.getThreadDataContext().performQuery(sq);
>
>
>


Re: setPageSize causes blowup?

Posted by Arturo Perez <ap...@hayesinc.com>.
Gentry, Michael (Contractor <michael_gentry <at> fanniemae.com> writes:

> 
> Are you calling setPageSize() before or after the performQuery()?

The code snippet is

		SelectQuery sq = new SelectQuery(XXX.class);
		sq.setPageSize(ListSelectPager.LIST_SELECT_PAGE_SIZE);
		return DataContext.getThreadDataContext().performQuery(sq);