openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pandel <pandel_c...@yahoo.com>
Subject Re: Calling a getter of an entity will access the broker
Date Tue, 27 Jul 2010 14:39:20 GMT

But in our application, there is no such thing as a "JPA server". It doesn't
follow the client-server model. It is just a desktop application and there's
no application server backing it. All the JPA operations have to be done by
the application itself.
Supposing there's an entity Customer, we need to query for the list of
Customers and detach them. Supposing we need to modify a Customer, eg. the
name, we use a textfield and a button. The way I see it, the modification
process would be:

void buttonActionPerformed(ActionEvent e) {
 detachedCustomer.setName(textField.getText());
 SwingWorker aWorker = new SwingWorker() {
  protected Object doInBackground() {
   entityManager.getTransaction().begin();
   entityManager.merge(detachedCustomer);
   entityManager.getTransaction().commit();
  }
})
}

Is there a better way of doing this, given the circumstances?
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Calling-a-getter-of-an-entity-will-access-the-broker-tp5325919p5342425.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message