On Tuesday, November 4, 2003, at 11:10 AM, Antonio Gallardo wrote:


Thanks for your feedback, Antonio.

Hi Jeremy:

I use other approach in Flow. Example:

function listform(form) {
  var factory = cocoon.getComponent(Packages.o.a.c....JdoPMF.ROLE);
  var bean = new Packages.test.forms.AreasList();
  var handler = new Packages.test.forms.AreaHandler();
  var criteria = new String (cocoon.request.criteria);

handler.getList(bean, criteria, factory); // Read from DB

OK, I think I understand your approach ..... AreaHandler.getList and AreaHandler.setList open and close the session as required. (?), so that the Session is actually closed before Form.showForm is called.


Does OJB have a concept similar to Hibernate's 'lazy-initialisation'?

I have not even approached this issue yet, because currently our User is not related to any other Tables, but it will be in the future .....

Does your AreaHandler clone the persistent properties into your Bean, or does it merely make object references? AFAIU if you are using lazy-initialisation, you would need to clone the values, to make sure the SQL calls were made while your session was still open..

  form.load(bean);
  form.showForm("list-form-display");
  form.save(bean);

  handler.setList(bean, criteria, factory); // Store in DB
  cocoon.releaseComponent(factory);
  // Show a succes page (end page).
  success("Administración de Areas",
          "Actualización de Áreas",
          "Todos los cambios se procesaron existosamente." +
          "¿Desea volver a procesar la lista de áreas?",
          "search");
}

Instead of open a OJB session inside the flow I call an FormHandler (in
Java) with the factory as a parameter. Inside the handle I open the OJB
transaction and close it after it fill the bean with a query.

I don't know if this is the better approach, but it works :-D

We are looking for a more generic solution to almost all the cases.

yes, this would be good ;)


I hope it would give you more ideas. I will be glad if you share it with
us. :-D

Thanks for your suggestions!


regards Jeremy



Reply via email to