0

我试图使用类似于以下内容的查询来查询实体内的嵌入式集合:

Query q = em.createQuery("SELECT u FROM User u , in (u.addresses) a
WHERE a.state='xx'");

查询没有返回任何结果,也没有抛出任何错误。我正在使用DatanucleusMongoDbDatanucleus对此类查询有任何限制吗?

实体看起来像:

public class User{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
protected long id;

@ElementCollection
protected List<Address> addresses;

public User(){
}

...

@Embeddable
public class Address {

  private String street;    
  private String city;
  private String state;
  private Integer zip;

  public Address(){
  }
  ...
4

0 回答 0