CRUD is conversational, but seam-gen is not
luxspes Jan 8, 2009 7:00 PMHi!
Lets say you have 2 classes:
class Parent{ private Long id; private Integer version; private String name; private Set <Child> children; }
and
class Child{ private Long id;private Integer version; private String name; private Parent parent; }
with a typical one to many / many to one relationship (Parent.children.Child/Child.parent.Parent)
So you want them to become @Entities and add the required @Annotations. Then you run seam-gen on them, and run you generated application:
- You click the Parent List menu option.
- You are presented with the page ParentList.seam that allows you search parents, or to create a new one.
- You click the Create parent button.
- You write a name for the parent:
Peter
. - You click
Save
. - You are presented with the page Parent.seam, that displays you newly persisted entity in a
read-only way
- You click
Done
so far so good... but then
- You click the Child List menu option.
- You are presented with the page ChildList.seam that allows you search children, or to create a new one
- You click the Create child button.
- You are presented with the page ChildEdit.seam.
- You write a name for your new Child entity:
John
- You decide that you want connect this new Child entity with a parent entity, and then you click
Select parent
. - You are presented again with ParentList.seam that allows you to
select
a parent. - So, you select
Peter
by clicking in theSelect
link - And you return to ChildEdit.seam, but the value for the name property of the Child is now lost.
I think seam-gen should be able to do this correctly, it may not seem like such a big deal in this simple example, but imagine if Child had 15 or 25 fields! Why should I need to re-write their values?
This is the kind of behaviour that should just work, by default, since seam-gen generates an application that is built on top of a conversational framework (Seam), but it does not... I seems to me that seam-gen was build based on the mistaken assumption that a CRUD application does not need conversations, but, it in fact does...
What do you think about this omission? Do you build a lot of applications to do CRUD with seam? how do you deal with this problem? Would you vote for a JIRA requesting a conversational seam-gen?