@uros: So, did that fixed the problem?
@Alejandro: It was definately lomboks autogenerated equals.
My solution is to remove @Data annotation from JPA classes, and replace them with @Getter and @Setter, of course if you are using lombok.
So to sum up:
If you are using lombok in project be sure to know this when using @Data on entities:
@Data
All together now: A shortcut for @ToString, @EqualsAndHashCode, @Getter on all fields, and @Setter on all non-final fields, and @RequiredArgsConstructor!
My equals in BaseEntity is:
@Override
public boolean equals(Object object) {
if (this == object)
return true;
if (object == null)
return false;
if (getClass() != object.getClass())
return false;
AeBaseEntity other = (AeBaseEntity) object;
return getId() != null && Objects.equals(getId(), other.getId());
}
Hello. This addon looks fantastic, but I am experiencing some problems when trying to use it with Vaadin 8.
I’m only doing the most basic:
GridBasedCrudComponent<ProductDto> crud = new GridBasedCrudComponent<>(ProductDto.class);
crud.setFindAllOperation(() -> ProductService::findAll);
but I’m getting errors about not being able to use Vaadin 7 classes:
“The project was not built since its build path is incomplete. Cannot find the class file for com.vaadin.v7.data.util.BeanItemContainer. Fix the build path then try building this project”
“The type com.vaadin.v7.data.util.BeanItemContainer cannot be resolved. It is indirectly referenced from required .class files”
I think it may be a silly error. Any ideas?
Yeah, I haven’t fully migrated to Vaadin 8, so you have to use the
compatibility packages
.
this does not seem to work well with autocomplete, using v7 widgetset crudui works but not autocomplete.
is the full port to v8 available anytime soon?
I don’t have a schedule for this. Need to find the time to fully upgrade it. What do you mean by “autocomplete”?
Oh, sorry, I mean the autocomplete addon. I haven’t found a way to make it work with the compatability widgetset.
No problem
But hey, there are many “autocomplete-something” add-ons. Mabe you can try an alternative:
https://vaadin.com/directory#!browse/search=autocomplete
Or contact the author of the add-on that’s not working for you.
I just did.
it’s called autocomplete-extension in Directory and on Github, it’s the artefactId that is just autocomplete.
Nice update 2.1.0 without compatibility dependency.
Will you publish it in Maven?
Right now the addon page says that “This component or version has not been published in Maven.”
Thank you!
It is now available in Maven… thumbs up! ![]()
Alejandro Hi. Do you have any suggestion for using filters with your addon?
I was using grid-util addon with Vaadin 7, but know in 8, it only works with ListDataProvider.
Thanks.
Hi Alejandro, the addon is really helpful. Thanks for the contribution!
I’m just getting a NoSuchMethod exception whenever I’m adding/deleting/updating new entities though.
The backend successfully executes the crud logic on the entities, but when GridCrud tries to show a Notification, the NoSuchMethod Exception is thrown.
The following line is where the exception is being thrown (the full stack trace is at the bottom of this post).
//GridCrud.java:233
Notification.show(successMessage);
Any ideas on why this would be happening?
I’m on Vaadin version 8.2.0 and CrudUi version 2.1.5.
java.lang.NoSuchMethodError: com.vaadin.ui.Notification.show(Ljava/lang/String;)V
at org.vaadin.crudui.crud.impl.GridCrud.lambda$showForm$b6493654$1(GridCrud.java:233) ~[crudui-2.1.5.jar:2.1.5]
at org.vaadin.crudui.form.AbstractAutoGeneratedCrudFormFactory.lambda$buildOperationButton$50f0727d$1(AbstractAutoGeneratedCrudFormFactory.java:256) ~[crudui-2.1.5.jar:2.1.5]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:499) ~[vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:273) ~[vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:237) ~[vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1014) ~[vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.ui.Button.fireClick(Button.java:384) ~[vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.ui.Button$1.click(Button.java:57) ~[vaadin-server-8.2.0.jar:8.2.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155) ~[vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:116) ~[vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:445) [vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:410) [vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274) [vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.communication.PushHandler.lambda$new$1(PushHandler.java:145) [vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.communication.PushHandler.callWithUi(PushHandler.java:235) [vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.communication.PushHandler.onMessage(PushHandler.java:520) [vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.communication.PushAtmosphereHandler.onMessage(PushAtmosphereHandler.java:87) ~[vaadin-server-8.2.0.jar:8.2.0]
at com.vaadin.server.communication.PushAtmosphereHandler.onRequest(PushAtmosphereHandler.java:77) ~[vaadin-server-8.2.0.jar:8.2.0]
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:223) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:115) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:67) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2284) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:593) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.websocket.DefaultWebSocketProcessor$3.run(DefaultWebSocketProcessor.java:345) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.util.VoidExecutorService.execute(VoidExecutorService.java:101) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:340) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.websocket.DefaultWebSocketProcessor.invokeWebSocketProtocol(DefaultWebSocketProcessor.java:447) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:272) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:269) ~[atmosphere-runtime-2.4.11.vaadin2.jar:2.4.11.vaadin2]
at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:399) ~[tomcat-embed-websocket-8.5.5.jar:8.5.5]
at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageText(WsFrameServer.java:106) ~[tomcat-embed-websocket-8.5.5.jar:8.5.5]
at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:500) ~[tomcat-embed-websocket-8.5.5.jar:8.5.5]
at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:295) ~[tomcat-embed-websocket-8.5.5.jar:8.5.5]
at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:131) ~[tomcat-embed-websocket-8.5.5.jar:8.5.5]
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:69) ~[tomcat-embed-websocket-8.5.5.jar:8.5.5]
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148) ~[tomcat-embed-websocket-8.5.5.jar:8.5.5]
at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_151]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_151]
Looks like a compilation problem. Try removing the dependency from your local Maven repository and compiling again.
Hi Alejandro,
this is a Vaadin issue, look at this topic:
I guess this is due to the signature change in
Notification.show(String)
in Vaadin Framework 8.2.0. I have uploaded a new version of crud-ui (2.3.0) compiled with Vaadin Framework 8.2.0.
Hi Alejandro, ~ a year ago you suggested to “Use the Bean Validation API or manually add Validators.”.
The latter takes my attention: How can I manually add validators when using crudui?
(Hint: I need to manually add validators as a workaround because class level bean validation (across multiple fields) seems not to work. If you think class level bean validation should work please let me know. That would even be better.)
@Thomas: I think the comment you quoted is valid for Vaadin 7 were you can add a Validator directly to an input field (e.g. lastNameTextField.addValidator(...)). In your case, that doesn’t apply since you want “cross field” validation. You can add any validation logic in your CrudListener implementation or specific operation listener without even using the Validator interface at all.