Sorry, the JpaQueryBuilder.class is part of Spring Data. The relevant OpenJPA 
class is PathImpl.class of course. 

This Method fails:

    public <Y> Path<Y> get(String attName) {
        Type<?> type = this.getType();
        if (type.getPersistenceType() == PersistenceType.BASIC) {
            throw new IllegalArgumentException(this + " is a basic path and can 
not be navigated to " + attName);
        }
        
        Members.Member<? super X, Y> next = (Members.Member<? super X, Y>) 
           ((ManagedType<? super X>)type).getAttribute(attName);
        return new PathImpl<X,Y>(this, next, next.getJavaType());
    }

"attName" has the value "pickBarcode.orderId" in my case. Do you expect a 
object-graph string in this method? If yes, it should work because 
pickBarcode.orderId is in fact part of my AlphaScan Class.


---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 28.08.2011 um 22:41 schrieb Marc Logemann:

> Hi,
> 
> in the Spring Data Forum we are discussing a problem which might be a OpenJPA 
> Bug. Please visit this thread as it contains all the stuff one needs to check 
> this issue:
> http://forum.springsource.org/showthread.php?113890-issue-with-Like-Or-and-nested-Properties-in-SpringData-JPA
> 
> I am coding against OpenJPA 2.1.0 and the problem arises when JpaQueryBuilder 
> will create a Like Predicate. 
> 
> Little stack trace also here ;-)
> 
> Caused by: java.lang.IllegalArgumentException: Attribute 
> "pickBarcode.orderId" of any not found in de.logentis.bwh.model.AlphaScan
>       at 
> org.apache.openjpa.persistence.meta.AbstractManagedType.notFoundException(AbstractManagedType.java:734)
>       at 
> org.apache.openjpa.persistence.meta.AbstractManagedType.getAttribute(AbstractManagedType.java:237)
>       at 
> org.apache.openjpa.persistence.meta.AbstractManagedType.getAttribute(AbstractManagedType.java:461)
>       at 
> org.apache.openjpa.persistence.criteria.PathImpl.get(PathImpl.java:270)
>       at 
> org.springframework.data.jpa.repository.query.JpaQueryCreator.toPredicate(JpaQueryCreator.java:204)
>       at 
> org.springframework.data.jpa.repository.query.JpaQueryCreator.create(JpaQueryCreator.java:102)
>       at 
> org.springframework.data.jpa.repository.query.JpaQueryCreator.create(JpaQueryCreator.java:51)
>       at 
> org.springframework.data.repository.query.parser.AbstractQueryCreator.createCriteria(AbstractQueryCreator.java:90)
>       at 
> org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:68)
>       at 
> org.springframework.data.jpa.repository.query.PartTreeJpaQuery.createCountQuery(PartTreeJpaQuery.java:101)
>       at 
> org.springframework.data.jpa.repository.query.JpaQueryExecution$PagedExecution.doExecute(JpaQueryExecution.java:106)
>       at 
> org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:55)
>       at 
> org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:100)
>       at 
> org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:89)
>       at 
> org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:336)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>       at 
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>       at 
> org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
>       ... 30 more
> 
> pickBarcode is an embedded attribute in AlphaScan and orderId is an attribute 
> in PickBarcode. When issueing the same query without like, everything is 
> fine. Spring Data JPA abstracts developers form creating the queries 
> themselves and instead we only need to create an interface with a method name 
> which exposes the query with some special syntax.
> 
> THanks for input on this. I could easily debug this stuff but i really dont 
> want to dig through OpenJPA internals. But if i can help by providing some 
> variables values or something, i am willing to help solving this.
> 
> ---
> regards
> Marc Logemann
> http://www.logemann.org
> http://www.logentis.de
> 
> 
> 
> 

Reply via email to