Wednesday, September 25, 2013

GWT Requestfactory JSR-303 Problems when updating entity

Dear Group,

I am using GWT Requestfactory for accessing server-side entities (JPA entities).
For validating data I apply JSR 303 validation.

Here is my situation:
1. On Persist everything works fine. Entity is validated on pre-persit and in case of constraint violations the "onConstraintViolation(..)" is called.
Persisting entities works fine.

2. Problem occurs when I try to edit an existing entity using  "entity2 = request.edit(sampleEntity);", write new data to it and send it to the server.
In that case a ConstraintViolation is thrown (probably this should be the case) but "onFailure(...)" method is called .... instead of the "onConstraintViolation(..)"?

What could be the reason for this??? Why is the "onConstraintViolation(..)" not called when updating the entity?
The error message is displayed below:

Thank you in advance:

Nermin


javax.validation.ConstraintViolationException: Validation failed for com.emajstor.server.persistence.PrivatePerson@2b85ffb8 during pre-update for groups [interface javax.validation.groups.Default] - exceptions are attached
    at org.datanucleus.validation.BeanValidatorHandler.validate(BeanValidatorHandler.java:71)
    at org.datanucleus.validation.BeanValidatorHandler.preStore(BeanValidatorHandler.java:86)
    at org.datanucleus.api.jpa.JPACallbackHandler.preStore(JPACallbackHandler.java:102)
    at org.datanucleus.state.JDOStateManager.flush(JDOStateManager.java:3827)
    at org.datanucleus.ObjectManagerImpl.flushInternalWithOrdering(ObjectManagerImpl.java:3888)
    at org.datanucleus.ObjectManagerImpl.flushInternal(ObjectManagerImpl.java:3811)
    at org.datanucleus.ObjectManagerImpl.flush(ObjectManagerImpl.java:3751)
    at org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java:4141)
    at org.datanucleus.ObjectManagerImpl.transactionPreCommit(ObjectManagerImpl.java:428)
    at org.datanucleus.TransactionImpl.internalPreCommit(TransactionImpl.java:398)
    at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:287)
    at org.datanucleus.ObjectManagerImpl.close(ObjectManagerImpl.java:1090)
    at org.datanucleus.api.jpa.JPAEntityManager.close(JPAEntityManager.java:193)
    at com.emajstor.server.AppHandlerFilter.doFilter(AppHandlerFilter.java:91)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectRequest(DevAppServerServersFilter.java:369)
    at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectServerRequest(DevAppServerServersFilter.java:352)
    at com.google.appengine.tools.development.DevAppServerServersFilter.doFilter(DevAppServerServersFilter.java:115)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:97)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:480)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment