[jboss-user] [JBoss Seam] - Re: Outjection problems with interface variables

SmokingAPipe do-not-reply at jboss.com
Sun Feb 11 13:37:19 EST 2007


I'm pretty sure I know what's going on.

Your interface is not a Seam-managed entity.  Therefore the Seam-entity's scope specification doesn't apply to it.  But when you use the real Seam entity, and not the interface, then those rules DO apply and you can't outject it to a wider context than the entity's specified context.  Make sense?

Here's an example.  java.lang.String is obviously not a Seam entity.  Let's say that I have a Seam entity called Book with Conversation scope, and the book implements the Item interface.

I can do this:

@Out(value="foo",scope=whatever) private String myString;

and indeed that string will be outjected.  The string is not a Seam-entity so it has no specified scope other than what I specify in the outjection.

If I do this:

@Out(value="foo",scope=Session) private Book myBook;

It won't work because Book has a specified scope (conversation) and cannot be outjected to a wider scope.

But if I do it like this:

@Out(value="foo",scope=Session) private Item myBook;

it's the exact same object, but Item is not a Seam entity, so the outjection works!  I think you are seeing inconsistent results because when you use the interface, the Seam scope specification doesn't exist, so you are creating a new one, whereas if you use the Seam-entity you are letting Seam manage it.


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

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



More information about the jboss-user mailing list