Cannot bind JPAContainer generated combobox with 7.1

Hey,

I am trying to switch from Vaadin 7.0 to 7.1 and am experiencing an error while binding a JPAContainer 3.0 generated combobox to a beanfieldgroup. I had no error previously…

The code :


final BeanFieldGroup<Devis> binder = new BeanFieldGroup<Devis>(Devis.class);
binder.setItemDataSource(devisEntity);

JPAContainer<TypeBien> typeBiens = JPAContainerFactory.make(TypeBien.class, em);
ComboBox typeBienBox = new ComboBox("Votre bien immobilier",biens);
typeBienBox.setContainerDataSource(biens);
typeBienBox.setNullSelectionAllowed(false);
typeBienBox.setItemCaptionPropertyId("denominationFr");
typeBienBox.setFilteringMode(FilteringMode.CONTAINS);
typeBienBox.setImmediate(true);
typeBienBox.setConverter(new SingleSelectConverter(bienBox));
binder.bind(typeBienBox, "typeBien");

The error (which is caused by the binder.bind method)

java.lang.AbstractMethodError: com.vaadin.addon.jpacontainer.fieldfactory.SingleSelectConverter.convertToPresentation(Ljava/lang/Object;Ljava/lang/Class;Ljava/util/Locale;)Ljava/la
ng/Object;
at com.vaadin.data.util.converter.ConverterUtil.convertFromModel(ConverterUtil.java:94)
at com.vaadin.ui.AbstractField.convertFromModel(AbstractField.java:708)
at com.vaadin.ui.AbstractField.convertFromModel(AbstractField.java:693)
at com.vaadin.ui.AbstractField.setPropertyDataSource(AbstractField.java:629)
at com.vaadin.data.fieldgroup.FieldGroup.bind(FieldGroup.java:265)
at com.vaadin.data.fieldgroup.BeanFieldGroup.bind(BeanFieldGroup.java:163)
at com.example.montkitv7.Montkitv7UI.initUpDevis(Montkitv7UI.java:222)
at com.example.montkitv7.Montkitv7UI.init(Montkitv7UI.java:133)
at com.vaadin.ui.UI.doInit(UI.java:603)
at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:223)
at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:73)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1329)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Apparently, using the SingleSelectConverter doesnt work the same way anymore with 7.1?
I can get rid of the exception if i remove the setConverter(new SingleSelectConverter()) bit, but then I cannot save my combobox because the link between the value and the id isnt made anymore…

Anybody got an idea how to solve this?

Thanks

EDIT : just saw this ticket opened a few hours ago :
http://dev.vaadin.com/ticket/12185
I guess its related!

i looked at http://dev.vaadin.com/ticket/12185 cannot understand whot does min “JPAContainer to be Vaadin 7.1 compatible”. i’m using jpacontainer 3.0.0 and there is no more last version, and under this version i,m geting the same error.
anybody have idea how to solve this?

JPAContainer 3.0.x works with Vaadin 7.0.x but does not work with Vaadin 7.1.x.

JPAContainer 3.1.x is not yet released. It will work with Vaadin 7.1.x (and probably later) but it does not work with Vaadin 7.0.x.

If you need to use this now, you need to build JPAContainer from its source code (latest changes in version control) where the fixes are already or patch the related classes - see the changes
here
.

Henri Sara, thanks for information about Vaadin and JPAContainer versions, It haven’t work to me but now it works, thanks.

One question/suggestion

When I try to find some value in the Combobox, it works, but every “character” it filter in the database, so imagine that the user type something like “RODRIGO RODRIGUES”, in console I realize that it execute 21 times query in the database, each filter per key pressed, it looks like

%R%
%RO%
%RODR%
%RODRIG%

does not it bad for performance? is possible to “SetDelay(int millisecond)” in the combobox to it only execute the filter after that delay?

Even though the necessary data is likely to be in cache after the first request, I agree this could be done more efficiently if letting the user control such a time window and using a sensible default value.

It is possible that this change would need to wait until we get to reworking the current combobox (which is badly overdue for a rewrite of the client side and internal communication mechanisms), but there should be a ticket for the issue so that it does not get forgotten. Please
create an enhancement request
for this.