-
1. Re: Factory not working correctly following action with view-id
pmuir Mar 26, 2008 7:14 PM (in response to pdhaigh)You need to show all your code - post all of the DAO,
-
2. Re: Factory not working correctly following action with view-id
pdhaigh Mar 26, 2008 7:32 PM (in response to pdhaigh)@Name ("webpageDAO") public class TextPageDAO extends EntityHome<TextPage> { /** * */ private static final long serialVersionUID = 1L; @Factory("webpage") @Transactional public TextPage initTextPage() { return getInstance(); } protected TextPage createInstance() { TextPage a = new TextPage(); return a; } public String getCreatedMessage() { return "New web page created with id: #{webpage.id}. "; } public String getUpdatedMessage() { return "Web page #{webpage.id} successfully updated. "; } public String getDeletedMessage() { return "Web page #{webpage.id} successfully deleted. "; } }
-
3. Re: Factory not working correctly following action with view-id
pmuir Mar 29, 2008 12:01 PM (in response to pdhaigh)Are you sure the result of the factory lookup is not being cached in the conversation?
-
4. Re: Factory not working correctly following action with view-id
pdhaigh Mar 30, 2008 8:11 PM (in response to pdhaigh)hi Pete, thanks for the reply
That does sound as though it would explain the behaviour... how do I check this, and more importantly, stop it occuring?
Also, is this something that has changed in a recent Seam release? - I've never seen this behaviour until recently...
cheers
phil
-
5. Re: Factory not working correctly following action with view-id
pmuir Mar 30, 2008 9:50 PM (in response to pdhaigh)Check whether the factory is run after the instance has changed and before the render.
There shouldn't be a change of behaviour here.
-
6. Re: Factory not working correctly following action with view-id
pdhaigh Mar 30, 2008 11:25 PM (in response to pdhaigh)Hi pete,
2008-03-30 22:10:40,606 [INFO dao.WebpageDAO] Setting id 28 2008-03-30 22:10:40,703 [INFO dao.WebpageDAO] Running webpage factory 2008-03-30 22:10:42,862 [INFO security.AuthenticatorAction] Authenticating PhilHaigh 2008-03-30 22:10:42,901 [INFO dao.WebpageDAO] Setting id 29
So, yes, the factory is run after setting the ID on the first page, then is not re-run after setting the ID on the second page. So it must be cached.
Is there any way I can force this?
cheers
phil
-
7. Re: Factory not working correctly following action with view-id
pmuir Mar 31, 2008 12:08 PM (in response to pdhaigh)Contexts.removeFromAllContexts("webpage");
- you can also put this in an @Observer method and raise the relevant when the variable needs refresh to further separate concerns.
-
8. Re: Factory not working correctly following action with view-id
barbacena Mar 31, 2008 5:58 PM (in response to pdhaigh)We created a component like this in our project.
I did a JSF ValueChangeListener as well to use in combined ajax selectOneMenuS.I think it is a good candidate for KnowledgeBase as best practice.
-
9. Re: Factory not working correctly following action with view-id
pdhaigh Apr 2, 2008 12:12 AM (in response to pdhaigh)Great, thanks very much :-)
I wonder if this could/should be part of the setId() method on EntityHome? I can't imagine an instance where you would want the default behaviour to be that you set the id, and then NOT get the updated component back from the factory?
p