This content has been marked as final.
Show 22 replies
-
15. Re: Who uses EntityHome objects?
gavin.king Feb 8, 2007 2:14 AM (in response to smokingapipe)My problem is to specify the id of an object. But i have realized, that the possibility to set the id in components.xml is no more there. With or without namespaces.
huh, why do you say that? use -
16. Re: Who uses EntityHome objects?
baz Feb 8, 2007 2:21 AM (in response to smokingapipe)hi gavin,
what was the rest of your posting? -
17. Re: Who uses EntityHome objects?
baz Feb 8, 2007 3:26 AM (in response to smokingapipe)Finally i got it.
<pages> <page view-id="/search.xhtml"> <param name="accountId" value="#{accountHome.id}" converterId="javax.faces.Long" /> </page> </pages>
This means that the value of the accountId parameter will be set to the Id of accountHome. This part was not obvious to me.:-(
And The value of the accountHome id will be remembered in the parameter. This comes out very clearly from the docs.
Ciao,
Carsten -
18. Re: Who uses EntityHome objects?
bulloncito Feb 12, 2007 4:36 PM (in response to smokingapipe)I'm having the same problem, I'm starting with seam, using EntityHome, and as far as I understand that only propagates the parameter to the page, still has to be injected, I use
@RequestParameter Long userId ;
however my source is nearly identical to the one in the exaples of reference documentation (started from seam-hotel-booking and extended it) and form always shows "Create" buttons, id is not being propagated, or EntityHome is not properly configured, I'm lost. I cannot update/delete wich was the main reason on using EntityHome. If I actually pess submit button to new #{userHome.persist} I get the following:java.lang.IllegalStateException: No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)
Apparently some validation assigned null variables where @NotNull fields were.
... is there any working EntityHome example ? searched examples dir for "EntityHome" and no strings were found. -
19. Re: Who uses EntityHome objects?
gavin.king Feb 12, 2007 10:41 PM (in response to smokingapipe)For a working example, see examples/contactlist, or simply generate an application using "seam setup new-project generate-entities".
-
20. Home Entity not partially working
bulloncito Feb 19, 2007 9:26 PM (in response to smokingapipe)... finally managed to use EntitiHome in my project, however this code works:
<factory name="user" value="#{userHome.instance}"/> <framework:entity-home name="userHome" entity-class="myPackage.User" entity-manager="#{entityManager}" />
while this one does not:@Name("userHome") @Scope(ScopeType.CONVERSATION) public class UserHome extends EntityHome<User> { @In EntityManager entityManager ; @RequestParameter Long userId ; @Factory("user") public User initUser() { return getInstance() ; } @End public String persist() { super.persist() ; return "users" ; } @End public String update() { setId( userId ) ; super.update() ; return "users" ; } @End public String remove() { setId( userId ) ; super.remove() ; return "users" ; } @Destroy @Remove public void destroy() {} }
... is this a bug ? or am I missing something ? I believe it's better to use inheritance to add some extra features by hand, but I can't :( -
21. Home Entity not Working
bulloncito Feb 19, 2007 9:29 PM (in response to smokingapipe)... finally managed to use EntitiHome in my project, however this code works:
<factory name="user" value="#{userHome.instance}"/> <framework:entity-home name="userHome" entity-class="myPackage.User" entity-manager="#{entityManager}" />
while this one does not:@Name("userHome") @Scope(ScopeType.CONVERSATION) public class UserHome extends EntityHome<User> { @In EntityManager entityManager ; @RequestParameter Long userId ; @Factory("user") public User initUser() { return getInstance() ; } @End public String persist() { super.persist() ; return "users" ; } @End public String update() { setId( userId ) ; super.update() ; return "users" ; } @End public String remove() { setId( userId ) ; super.remove() ; return "users" ; } @Destroy @Remove public void destroy() {} }
... everything else is the same.
... is this a bug ? or am I missing something ? I believe it's better to use inheritance to add some extra features by hand, but I can't :( -
22. Re: Who uses EntityHome objects?
seto Feb 19, 2007 9:51 PM (in response to smokingapipe)From the documents, you can see that the right way is to override the getId(). But it isn't correct to setId for the update() or remove()