[jboss-user] [JBoss Seam] - Some philosophy on the context name and access to Java Backi

toni do-not-reply at jboss.com
Wed Nov 22 05:14:18 EST 2006


I'm using an "Entity Bean" as a backing bean to store the values from a form submited via a a post request.

I have noticed that in order to be able to access the instance of the "Entity Bean" in a "Session Bean" I have to use a syntax like:

EntityBean entityBean;

If I instead only use
EntityBean entityBean;

I get an exception, saying that the "In" requires a value, which implies that the instance of the EntityBean has not yet been bound to any one of the 6 seam contexts by a name.

Otherwise the second "In" should return an instance. But it returns null.

However, an instance of the EntityBean must exist somewhere else, because the post requests values must be kept somewhere.

What confuses me is the syntax of the @In(create=true), because the instance of the EntityBean must have been already created before we reach this annotation.

Shouldn't it be named more appropriately "(bound=true)" or "(bindToDefinedContext=true)" or something which refelcts this relationship more closely?

Because if it actually were created just when we reach the annotation, then all the values of it would be null or set to the default. 

Any comments on the subject?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987839#3987839

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987839

More information about the jboss-user mailing list