MountainClimb / datanucleus-appengine

Automatically exported from code.google.com/p/datanucleus-appengine
0 stars 0 forks source link

AND filter with one Key will return nothing #217

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Model files:

package test;
import javax.persistence.*;
import com.google.appengine.api.datastore.Key;

@Entity
public class OrderForm implements java.io.Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key orderFormId;

    @Basic
    private String uuid;
    public String getUuid() {
        return uuid;

    }

    public void setUuid(String p) {
        this.uuid = p;
    }

    @ManyToOne
    private Store store;
    public Store getStore() {
        return store;

    }

    public void setStore(Store s) {
        this.store = s;
    }

}

package test;
import java.util.List;
import javax.persistence.*;

import com.google.appengine.api.datastore.Key;

@Entity
public class Store {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key storeId;

    public Key getStoreId() {
        return storeId;
    }

    @OneToMany(mappedBy = "store")
    private List<OrderForm> orderForms;

    public List<OrderForm> getOrderForms() {
        return orderForms;
    }

}

2. The following query will always return nothing:
  Query q = em.createQuery(" SELECT  FROM " + OrderForm.class.getName() + " s1 WHERE  s1.store=?1 AND s1.uuid=?2 ");
  q.setParameter(1, store);
  q.setParameter(2, uuid);

What is the expected output? What do you see instead?
Data should not be empty. Because if I query the data with only one filter, 
either store or uuid, I got my data.

What version of the product are you using? On what operating system?
App Engine 1.3.5
Windows XP

Please provide any additional information below.

Original issue reported on code.google.com by YiZhan...@gmail.com on 16 Jul 2010 at 12:25

GoogleCodeExporter commented 8 years ago
Confirmed.  Queries with more than one positional parameter don't work.

Original comment by max.r...@gmail.com on 20 Aug 2010 at 4:46

GoogleCodeExporter commented 8 years ago

Original comment by max.r...@gmail.com on 20 Aug 2010 at 11:03

GoogleCodeExporter commented 8 years ago

Original comment by max.r...@gmail.com on 26 May 2011 at 11:32