Looking through page at http://aries.apache.org/modules/jpaproject.html and
samples at
https://svn.apache.org/repos/asf/aries/trunk/jpa/examples/tasklist-blueprint/src/main/java/org/apache/aries/jpa/example/tasklist/blueprint/impl/
I understand that I should use EmSupplier if I want thread safe application.

But I cannot understand some rows in the example.

    @Transaction 
    @Override
    public void addTask(Task task) {
        em.get().persist(task);
        em.get().flush();
    }
Does @Transaction annotation do or mean something? How is it merged with
<tx> tag in blueprint config?
Shouldn't I get EntityManager once in a method and use it?
  EntityManage em =  emSupplier.get();
  em.persist(task);
  em.flush();


   @Override
    public void deleteTask(Integer id) {
        em.get().remove(getTask(id));
    }
Why we delete newly queried object from database instead of object that
client views? There can be changes from other clients in database and we
delete the same object but not the same object state.
I'd like to be sure that I delete that I viewed.

    public void setEm(EmSupplier em) {
        this.em = em;
    }
Is there any need in this setter method?! I thought there is field
injection.



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Aries-JPA-EmSupplier-understanding-tp4042066.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to