You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Andrew Schmidt (JIRA)" <ji...@apache.org> on 2019/06/11 19:18:00 UTC
[jira] [Comment Edited] (DELTASPIKE-1377) issue with @Repository +
@Query annotation and clustered wildfly
[ https://issues.apache.org/jira/browse/DELTASPIKE-1377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16861374#comment-16861374 ]
Andrew Schmidt edited comment on DELTASPIKE-1377 at 6/11/19 7:17 PM:
---------------------------------------------------------------------
Ok and I checked out the beans inside the contextual store. And noticed the @QueryHint has an object ID, which changes depending on which machine it's own.
{code:java}
org.apache.deltaspike.core.util.bean.ImmutableBeanWrapper:AnimalRepo[@javax.enterprise.context.ApplicationScoped()@org.apache.deltaspike.data.api.Repository(forEntity=class java.lang.Object,methodPrefix=)]{AnimalRepo.findByName[@org.apache.deltaspike.data.api.Query(hints=[Ljavax.persistence.QueryHint;@1f783403,isNative=false,lock=NONE,max=0,named=,singleResult=JPA,value=select a from Animal where ?1 = a.name)](java.lang.String);}{code}
So that one has @1f783403 for QueryHint and the one in the previous comment says @7bbfe365
So why does weld choose that as the beanIdentifier?
was (Author: andrew.schmidt):
Ok and I checked out the beans inside the contextual store. And noticed the @QueryHint has an object ID, which changes depending on which machine it's own.
{code:java}
org.apache.deltaspike.core.util.bean.ImmutableBeanWrapper:AnimalRepo[@javax.enterprise.context.ApplicationScoped()@org.apache.deltaspike.data.api.Repository(forEntity=class java.lang.Object,methodPrefix=)]{AnimalRepo.findByName[@org.apache.deltaspike.data.api.Query(hints=[Ljavax.persistence.QueryHint;@1f783403,isNative=false,lock=NONE,max=0,named=,singleResult=JPA,value=select a from Animal where ?1 = a.name)](java.lang.String);}{code}
So that one has @1f783403 and the one in the previous comment says @7bbfe365
So why does weld choose that as the beanIdentifier?
> issue with @Repository + @Query annotation and clustered wildfly
> -----------------------------------------------------------------
>
> Key: DELTASPIKE-1377
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1377
> Project: DeltaSpike
> Issue Type: Bug
> Components: Data-Module
> Affects Versions: 1.9.0
> Reporter: Andrew Schmidt
> Priority: Major
> Attachments: cdri-test.zip, stack.txt
>
>
> Setup: 2 x wildfly 15.0.1.Final (weld-core updated to 3.0.6)
> Clustered standalone-full-ha setup, same machine with a port offset for the second machine.
>
> Repo:
> {code:java}
> @Repository
> @ApplicationScoped
> public interface AnimalRepo extends EntityRepository<Animal, String>
> {
> @Query( value = "select a from Animal where ?1 = a.name" )
> Animal findByName(String name);
> }
> {code}
> Session bean:
> {code:java}
> @SessionScoped
> @Named
> public class MyBean implements Serializable
> {
> private static final long serialVersionUID = 1L;
> @Inject
> private AnimalRepo animalRepo;
> public Long getTest()
> {
> return animalRepo.count();
> }
> }
> {code}
> index.xhtml
> {code:java}
> <h:form>
> #{myBean.test}
> </h:form>
> {code}
> Visiting the first server yields no error, but upon visiting the second server:
> {code:java}
> WELD-001500: Failed to deserialize proxy object with beanId org.apache.deltaspike.core.util.bean.ImmutableBeanWrapper:AnimalRepo[@javax.enterprise.context.ApplicationScoped()@org.apache.deltaspike.data.api.Repository(forEntity=class java.lang.Object,methodPrefix=)]{AnimalRepo.findByName[@org.apache.deltaspike.data.api.Query(hints=[Ljavax.persistence.QueryHint;@774c6737,isNative=false,lock=NONE,max=0,named=,singleResult=JPA,value=select a from Animal where ?1 = a.name)](java.lang.String);}
> {code}
> Interestingly, If the @Query annotation is removed from the findByName query, there is no issue.
> See attached project.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)