-
1. Re: Stateless wiht state?
sander Jun 28, 2008 1:35 PM (in response to monkkey)The object is returned to the pool. When requesting a new object they will come from the instance pool, how many objects are in the pool depends on your config.
Because you'll probably use only one user for testing/dev you get the same instance the whole time.
Just don't use object scoped vars in stateless beans, there are statefull beans to do that.
-
2. Re: Stateless wiht state?
monkkey Jun 28, 2008 6:08 PM (in response to monkkey)Hi Sander, thanks for your answer.
Yes, i use a stateless with an attribute for manage the crud operations. This is bad? I think that use a stateful for this is too much.
this is my code:
@Stateless @Name("proyectosAction") public class ProyectosActionBean implements ProyectosAction { @PersistenceContext EntityManager em; private Proyecto nuevoProyecto; public String editProyecto(Long id) { this.setNuevoProyecto(em.find(Proyecto.class, id)); return "editarProyecto"; } public String guardadProyecto() { em.merge(this.getNuevoProyecto()); return this.listarProyectos(); }
I have an error when try paste my xhtml here :(.
If I don't set the attribute
nuevoProyecto
then I have an error, when the page render I obtain the errornuevoProyecto
is null'Thanks and sorry for my writing. I learn.
-
3. Re: Stateless wiht state?
sander Jun 28, 2008 7:25 PM (in response to monkkey)Then make it a statefull bean.
I don't actually know when to use statefull and stateless in seam because I don't use ejb3 for my components. But look at the examples how is it handled in there you'd might get something out of it.
Furthermore; some reading on ejb3 could help you a bit understanding it all. Why are you using it in the first place, why not using only the servlet?
-
4. Re: Stateless wiht state?
admin.admin.email.tld Jun 29, 2008 4:19 AM (in response to monkkey)If the EJB is a backing bean for your JSF, then you should use a SFSB, especially if you need to maintain the client's state (@Begin and @End Seam annotations).
Stateless session beans are typically used when you don't need to maintain the client's state (e.g. a credit card verification service that can also be exposed as a web service).
read the Seam ref pdf that comes with the Seam distro as well as JSR 220 core. also look at the hotel booking example code.
-
5. Re: Stateless wiht state?
monkkey Jun 29, 2008 4:38 AM (in response to monkkey)Hi thanks to both. Yes, I use a SLSB whit a conversation, it is the correct manner.
I should love more to the SFSB and use less SLSB :)Thanks again!
Bye. -
6. Re: Stateless wiht state?
monkkey Jun 29, 2008 4:40 AM (in response to monkkey)I want say SFSB, no SLSB