-
1. Re: Basic entity editing in Seam 3 through webform
lightguard Jun 17, 2011 4:05 PM (in response to hamtho2)You'll need to create a producer (@Produces) for the entity in question as directly injecting an entity which the BeanManager instantiates is not a good idea.
Injections happen with @Inject.
-
2. Re: Basic entity editing in Seam 3 through webform
hamtho2 Jun 21, 2011 10:07 AM (in response to hamtho2)Hi,
thanks for the answer.
I´m already working with a producer. But this only works as long as I have my ActionBean marked as @SessionScoped.
As soon as I change it to somewhat like @RequestScoped I always receive an error, when I enter the page.SessionScope is actually not what I want, as the user should not be put into the session, but always stay within the scope of the form and has to disappear as soon as the form has been submitted successfully. Or how would I clear the session variable?
How would I proceed this way?
-
3. Re: Basic entity editing in Seam 3 through webform
ssachtleben.ssachtleben.gmail.com Jun 21, 2011 10:33 AM (in response to hamtho2)What error occures?
-
4. Re: Basic entity editing in Seam 3 through webform
hamtho2 Jun 21, 2011 10:52 AM (in response to hamtho2)Currently I would receive a LazyInitializationException on my entity-collections during page-load.
-
5. Re: Basic entity editing in Seam 3 through webform
lightguard Jun 21, 2011 5:48 PM (in response to hamtho2)What's the producer for the EntityManager scoped?
-
6. Re: Basic entity editing in Seam 3 through webform
ssachtleben.ssachtleben.gmail.com Jun 21, 2011 5:58 PM (in response to hamtho2)Well if you inject a dao class to load the entity you will have to load the entity collections on your own. I think the entity is not attached to the entitymanager any more which produces the LazyInitializationException. If you load the entity from the entitymanager in the same bean they will fetch during the process.
-
7. Re: Basic entity editing in Seam 3 through webform
lightguard Jun 22, 2011 3:02 AM (in response to hamtho2)All depends if the instance of the EntityManager from which the entity was originally retrieved is still around (attached entity). You could debug and see if it's the same EM.