Announcement Announcement Module
No announcement yet.
EntityManager was not closed after non-transactional query Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • EntityManager was not closed after non-transactional query

    I used spring Roo m2 to generate some code and run it on GAE.

    I have some issues. Here is what I want to do
    -- run a query to get a couple of entities (e.g. price promotions)
    -- update each entity (expire promotion)
    -- add one new eneity (create new promotion)

    The first step "query" does not have to be in one tx. The problem is that the entityManager is not closed after the query is executed, which causes the next step fail on GAE. The error message is
    xxxObject is managed by a different Object Manager;

    My question is how can I explicitly close the entityManager after the query without declaring it is "transactional". em.close() does not work as Spring inject SharedEntityManagerInvocationHandler which does nothing when close() method is called.

    BTW, I cannot make the query "transactional" because GAE does not allow one transaction deal with entities in different entity group, even it is just a query. In my case, the price promotions belong to different products which are top level entities and are in different entity groups...

  • #2
    anybody can help?