cancel
Showing results for 
Search instead for 
Did you mean: 

Better Design for EJB 3 and Java Web Dynpro

Former Member
0 Kudos

Hi all,

When using EJB Model on CE, to each method a Request and Response are generated. To a CRUD i've 4 methods.

I've a Foo (JPA Entity).

public Foo create(Foo)

public Foo update(Update)

public void remove(Foo)

public List<Foo> findBy...

I think that i could use a Single view for both create and update method. But i will need a separated context objects to each function.

Request_<Bean>_create

Request_<Bean>_update

What is better in this case? a single method createOrUpdate on my EJB? Or a View to each operation?

Best regards

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi all,

Just to share my decision:

My EJB continue with the methods.

public Foo create(Foo)

public Foo update(Update)

public void remove(Integer)

public List<Foo> findBy...

Was generated one Request to each method.

Request_<Bean>_create

Request_<Bean>_update

I've mapped the both on my Component controller and have created on view to edit and create a new record.

When the record already exists i'm initializing the Request_<Bean>_createElement with record data, when is a new i've just initialize the new Foo object and put on currentElement of update.

On the generic save method of controller, a test is done to decide if the Request<Create> or Request<Update> model Object.

Best regards