"not-equal" filters are not supported in the current SDK unless you're doing "not equal null," in which case we just turn it into " > null" because the datastore considers null to be smaller than any non-null value. You can read about the supported filter types here: http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html
In the forthcoming SDK "not-equal" filters will be supported (along with "IN" filters). Max On Sat, Oct 31, 2009 at 8:34 AM, Dave Cheong <d...@davecheong.com> wrote: > > And > > public void myMethod2() { > Query query = entityManager.createQuery("select o from Myclass > o where o.title = :p1 and o.myProperty <> :p2"); > // bind params > query.getResultList(); > // exception thrown unexpectedly also > } > > On Nov 1, 3:32 am, Dave Cheong <d...@davecheong.com> wrote: > > 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 <d...@davecheong.com> 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 <andy_jeffer...@yahoo.com> 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 google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~----------~----~----~----~------~----~------~--~---