The relevant code snippets are:

In MyServiceImpl -

@Repository
@Transactional
public MyServiceImpl ... {

    protected EntityManager entityManager;

    public void myMethod() {
        Query query = entityManager.createQuery("select o from Myclass
o where o.title = :p1 and o.myProperty != :p2");
        // bind params
       query.getResultList();
       // exception thrown unexpectedly
    }

    @PersistenceContext
    public void setEntityManager(EntityManager entityManager) {
        this.entityManager = entityManager;
    }

}

In applicationContext.xml -

    <!-- JPA EntityManagerFactory -->
    <bean id="entityManagerFactory"
 
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"
          p:persistenceUnitName="main"/>

    <!-- Transaction manager for a single JPA EntityManagerFactory
(alternative to JTA) -->
    <bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager"
          p:entityManagerFactory-ref="entityManagerFactory"/>

In persistence.xml -

    <persistence-unit name="main">
 
<provider>org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider</
provider>
        <properties>
            <property name="datanucleus.NontransactionalRead"
value="true"/>
            <property name="datanucleus.NontransactionalWrite"
value="true"/>
            <property name="datanucleus.ConnectionURL"
value="appengine"/>
        </properties>
    </persistence-unit>


Any help you provide is appreciated.

thanks,
dave


On Nov 1, 3:23 am, Dave Cheong <[email protected]> wrote:
> What I'm saying is I'm using EMF and writing JPQL and "<>" is not
> working, which it should since it is the valid operator for
> inequality. Are you saying it works for you?
>
> dave
>
> On Nov 1, 12:27 am, datanucleus <[email protected]> wrote:
>
>
>
> > > 1). I can't seem to get "!=" working either.
>
> > I have no such problems with JDOQL, but then you're using it in GAE/J
> > with an old version of DataNucleus.
>
> > > 2) If I have mapped my objects using JPA annotations, will the query
> > > engine default to JDOQL vs JPQL?
>
> > The type of metadata specification ... JDO XML, JDO Annotations, JPA
> > XML, JPA Annotations ... has nothing to do with the persistence API
> > being used (in DataNucleus). If you create a PMF then you use JDO API,
> > if you create an EMF then you use JPA API. JPA API only allows JPQL
> > queries (you can't use JDOQL). JDO API allows JDOQL or JPQL queries,
> > using the API to define what you're using; see the JDO javadocs.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to