Hi Bruno,
In previous project I had use GWT 1.4 + GWT-Ext with GWT-Plus and Hibernate4GWT 1.0.4 and everything worked ok. But now I've got project with GWT 1.5 + GWT-Ext with GWT-Plus and Hibernate4GWT 1.1.1 + GWT-Sl and there's problem with PagingList - on the client side the information about TotalRecord (int) is lost and always is 0. I wonder if it's hb4gwt problem or GWT-Sl. Do you have any idea what could be wrong?
Regards,
Maciej Matecki
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Bruno,
Before sending it through RPC everything is ok. The information is lost during RPC. Total records is a primitive type (int).
Regards,
Maciej Matecki
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Bruno,
I've just compile the version from SVN and unfortunately there's still problem with totalRecords. In last moment before return of PagingList from RPCImpl everything is ok.
Regards,
Maciej Matecki
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since the source code of GWT-Plus is not available, can you execute the following test and tell me if it works :
PagingList list = new PagingList();
list.setTotalRecords(2);
assertEquals(2, list.getTotalRecords());
Regards
Bruno
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Bruno,
If I send that PagingList through RPC the information about totalRecords also lost. Of course if I create a PagingList on client side everything works ok.
One more thing. In the times of GWT 1.4.62 the configuration with GWT 1.4 + hb4gwt 1.0.4 worked ok with that PagingList. Currenty I've got GWT 1.5 + hb4gwt from SVN (the same issue is with Gilead) + GWT-Sl and now the totalRecords information is lost.
Best regards,
Maciej Matecki
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you check totalRecords value *before* sending it through RPC ?
I think that maybe this member is a shortcut to an internal, computed value, so setting it to a specific value can have no effect.
The reason why it worked with release 1.0.4 is that non persistent classes (such as PagingList) where passed to RPC without treatment. It was a mistake, since such instance can *contain* persistent data that needed to be treated. That's why all instance that now contain persistent data is cloned and merged, but they must be real Java Beans to be treated correctly.
Regards
Bruno
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Bruno,
Before sending it through RPC everything is ok. The information is lost during RPC. Total records is a primitive type (int).
Regards,
Maciej Matecki
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Bruno,
I've done a very ugly modification of cloneCollection and everything works ok. So if you've got any idea to do that better way I'm waiting for info :)
Here's cloneCollection method after my modification:
protected Collection cloneCollection(Collection hibernatePojoList, boolean assignable)
{
// Clone each element of the collection
//
int totalRecords=0;
if (hibernatePojoList instanceof PagingList)
{
I am planning to use Hibernate4GWt with gwt-ext plus.
Can you please share some information about this - in what mode you used hibernate4gwt-stateless, dynamic proxy, statefull?
Can you give me some tips how to use them together - problems and resolutions?
Thank you in advance,
Yuri
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Yuri,
I use hibernate4gwt in dynamic proxy mode. Now everything works great. If you have any questions I've just send you an email.
Regards,
Maciej Matecki
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ugly indeed ;-)
Sanjiv sent me source code of class PagingList, and I just understand what's going wrong : PagingList extends ArrayList.
I think that beanlib or hibernate4gwt (and Gilead) consequently consider it as a basic array list and do net clone its only attribute (totalRecords).
I will try to find a proper fix for this.
Regards
Bruno
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Bruno,
In previous project I had use GWT 1.4 + GWT-Ext with GWT-Plus and Hibernate4GWT 1.0.4 and everything worked ok. But now I've got project with GWT 1.5 + GWT-Ext with GWT-Plus and Hibernate4GWT 1.1.1 + GWT-Sl and there's problem with PagingList - on the client side the information about TotalRecord (int) is lost and always is 0. I wonder if it's hb4gwt problem or GWT-Sl. Do you have any idea what could be wrong?
Regards,
Maciej Matecki
Hi Maciej,
The PagingList class must be a Java Bean (it should provide a getTotalRecord and a setTotalRecord methods).
Is it the case ?
Regards
Bruno
Hi Bruno,
Before sending it through RPC everything is ok. The information is lost during RPC. Total records is a primitive type (int).
Regards,
Maciej Matecki
Hi,
Yes it provides get/setTotalRecords methods.
Regards,
Maciej Matecki
Hi,
The PagingList issue seems to have been solved (see https://sourceforge.net/forum/message.php?msg_id=5287429 for details).
Can you check if the latest version from SVN solves your issue ?
Regards
Bruno
Hi Bruno,
I've just compile the version from SVN and unfortunately there's still problem with totalRecords. In last moment before return of PagingList from RPCImpl everything is ok.
Regards,
Maciej Matecki
And one more thing. I tried to use PagingList in Gilead and there also attribute totalRecords is lost.
Regards,,
Hi Maciej,
Since the source code of GWT-Plus is not available, can you execute the following test and tell me if it works :
PagingList list = new PagingList();
list.setTotalRecords(2);
assertEquals(2, list.getTotalRecords());
Regards
Bruno
Hi Bruno,
If I send that PagingList through RPC the information about totalRecords also lost. Of course if I create a PagingList on client side everything works ok.
One more thing. In the times of GWT 1.4.62 the configuration with GWT 1.4 + hb4gwt 1.0.4 worked ok with that PagingList. Currenty I've got GWT 1.5 + hb4gwt from SVN (the same issue is with Gilead) + GWT-Sl and now the totalRecords information is lost.
Best regards,
Maciej Matecki
Hi Maciej,
Can you check totalRecords value *before* sending it through RPC ?
I think that maybe this member is a shortcut to an internal, computed value, so setting it to a specific value can have no effect.
The reason why it worked with release 1.0.4 is that non persistent classes (such as PagingList) where passed to RPC without treatment. It was a mistake, since such instance can *contain* persistent data that needed to be treated. That's why all instance that now contain persistent data is cloned and merged, but they must be real Java Beans to be treated correctly.
Regards
Bruno
Hi Bruno,
Before sending it through RPC everything is ok. The information is lost during RPC. Total records is a primitive type (int).
Regards,
Maciej Matecki
ok, I will contact GWT-Plus author to check the with them.
Regards
Bruno
Thank you very much. I'll be waiting for any info.
Regards,
Maciej Matecki
Hi Bruno,
I've done a very ugly modification of cloneCollection and everything works ok. So if you've got any idea to do that better way I'm waiting for info :)
Here's cloneCollection method after my modification:
protected Collection cloneCollection(Collection hibernatePojoList, boolean assignable)
{
// Clone each element of the collection
//
int totalRecords=0;
if (hibernatePojoList instanceof PagingList)
{
totalRecords = ((PagingList) hibernatePojoList).getTotalRecords();
}
Collection clonePojoList = createNewCollection(hibernatePojoList);
for (Object hibernatePojo : hibernatePojoList)
{
clonePojoList.add(clone(hibernatePojo, assignable));
}
if (clonePojoList instanceof PagingList)
{
((PagingList) clonePojoList).setTotalRecords(totalRecords);
}
return clonePojoList;
}
I'm thinking about some kind of interceptor in Spring to do that but I leave that for tomorrow ;)
Regards,
Maciej Matecki
Here's my MethodInterceptor for Spring. It's should resolve issue with lack information about totalRecords after clone.
public class TotalRecordsInterceptor implements MethodInterceptor{
private int totalRecords;
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
Log logger = LogFactory.getLog(TotalRecordsInterceptor.class);
Object[] argument = methodInvocation.getArguments();
for (Object o : argument)
{
if (o instanceof PagingList)
{
PagingList pList = (PagingList) o;
totalRecords = pList.getTotalRecords();
logger.info("TotalRecords before:" + totalRecords);
}
}
Object result = methodInvocation.proceed();
if (result instanceof PagingList)
{
((PagingList) result).setTotalRecords(totalRecords);
logger.info("Total Records after: "+((PagingList)result).getTotalRecords());
}
return result;
}
}
I hope it'll be useful for somebody.
Regards,
Maciej Matecki
Hi Maciej,
I am planning to use Hibernate4GWt with gwt-ext plus.
Can you please share some information about this - in what mode you used hibernate4gwt-stateless, dynamic proxy, statefull?
Can you give me some tips how to use them together - problems and resolutions?
Thank you in advance,
Yuri
Hi Yuri,
I use hibernate4gwt in dynamic proxy mode. Now everything works great. If you have any questions I've just send you an email.
Regards,
Maciej Matecki
Hi Maciej,
Ugly indeed ;-)
Sanjiv sent me source code of class PagingList, and I just understand what's going wrong : PagingList extends ArrayList.
I think that beanlib or hibernate4gwt (and Gilead) consequently consider it as a basic array list and do net clone its only attribute (totalRecords).
I will try to find a proper fix for this.
Regards
Bruno
Fixed in SVN for both hibernate4gwt and gilead.
Regards
Bruno
Hi Bruno,
I didn't saw your posts and I've just posted my interceptor. I'll test fix from SVN tomorrow.
Thank you very much.
Regards,
Maciej Matecki