Hi all,
in JPA you can do this:
Employee nonPersistentEmpl = new Employee(); /** employee fields are set here */ Employee persistentEmpl = entityManager.persist(nonPeristentEmpl);
so
nonPersistentEmpl
is a simple pojo.
In CAF, I can instantiate a BO just in the same way, but I can't find a
persist(Object)
method.
We only have
create(void)
method, which does not accept a parameter and creates an empty row in the db table.
As a consequence, to achieve a similar behavior as in JPA, I am forced to do this in my application service:
public Employee createEmployee(Employee emp){
Employee dummy = this.getEmployeeService().create();
emp.setKey(dummy.getKey());
this.getEmployeeService().update(emp);
return emp;
}
This seems to add a bit of unnecessary complexity.
Am I missing something?
Thanks, regards
Vincenzo