This content has been marked as final.
Show 2 replies
-
1. Re: Two entityhome instance on a form
blabno Oct 2, 2009 11:19 PM (in response to jamescheam)You can have two Seam components (thus two entity homes in your case) by using @Role annotation.
Better solution I think is to have different DB structure :Menu:
- id
- code
- (@OneToMany @JoinTable(name="MENU_LABELS")) List<Label> labels
Label:
- labelId
- languageCode
- value
With this, you need only one entity home.
-
2. Re: Two entityhome instance on a form
blabno Oct 3, 2009 12:48 PM (in response to jamescheam)There are several options.
1. In Menu entity constructor you can populate
labels
attribute :public Menu() { labels = new ArrayList<Label>(2); labels.add(new Label("en")); labels.add(new Label("cn")); }
2. Better solution in my opinion is to call custom method on MenuHome just before you start creating Menu, i.e. I do this from s:link :
public void startCreateProcess() { getInstance().labels = new ArrayList<Label>(2); instance.labels.add(new Label("en")); instance.labels.add(new Label("cn")); }
<s:link value="Create" view="/menu.xhtml" action="#{menuHome.startCreateProcess}"/>