Announcement Announcement Module
Collapse
No announcement yet.
GWT App Engine problem with MEMBER OF Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • GWT App Engine problem with MEMBER OF

    I'm using Spring ROO with GWT and App Engine for my new project and so far the technology is great!
    But I encountered a problem last week.

    I have these two entities: Item and ItemCategory.

    @RooJavaBean
    @RooToString
    public class ItemCategory {
    private String name;
    }

    @RooJavaBean
    @RooToString
    public class ItemCategory {
    @ManyToMany(cascade = CascadeType.ALL)
    private Set<ItemCategory> categories = new HashSet<ItemCategory>();
    }


    And then I made the custom finder to search for items that contains a specific category :

    @SuppressWarnings("unchecked")
    @Transactional
    public static List<Item> Item.findByCategory(ItemCategory category) {
    Query q = Item.entityManager().createQuery("SELECT o FROM Item AS o WHERE :category MEMBER OF o.categories").setParameter("category", category);
    return q.getResultList();
    }

    But it returned me the following error :
    Server Error: Field "categories" does not exist in com.test.intranet.Item or is not persistent;

    Anyone know how to solve this problem?
    Thank you very much.

  • #2
    categories is stored as categoriesKeys

    Ok I found out that the member categories is stored as categoriesKeys in the Datastore.

    So I tried "SELECT o FROM Item AS o WHERE :category MEMBER OF o.categoriesKeys" but sadly it gives me this error:

    Server Error: Illegal argument; nested exception is javax.persistence.PersistenceException: Illegal argument

    Comment

    Working...
    X