<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Contextual injection of core domain concepts with Seam</title>
	<atom:link href="http://solutionsfit.com/blog/2007/12/20/contextual-injection-of-core-domain-concepts-with-seam/feed/" rel="self" type="application/rss+xml" />
	<link>http://solutionsfit.com/blog/2007/12/20/contextual-injection-of-core-domain-concepts-with-seam/</link>
	<description>Blog by a developer for a developer</description>
	<lastBuildDate>Tue, 24 Aug 2010 13:52:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: jacob.orshalick</title>
		<link>http://solutionsfit.com/blog/2007/12/20/contextual-injection-of-core-domain-concepts-with-seam/comment-page-1/#comment-47</link>
		<dc:creator>jacob.orshalick</dc:creator>
		<pubDate>Fri, 21 Dec 2007 13:59:10 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/12/20/contextual-injection-of-core-domain-concepts-with-seam/#comment-47</guid>
		<description>Thanks for the comments, keep them coming as well ;)

&lt;blockquote cite=&quot;YourKnowWho&quot;&gt;
A. ... In that case, if they were SEAM components, they will by default be in CONVERSATION scope. In cases where the domain object is needed only in specific sections (or pages) of the application, one can very well make the domain object conversation scope. However, that also means that the pages involved have to use the same conversation which may or may not be the case.
&lt;/blockquote&gt;

You should definitely always consider the scope you are outjecting to.  In regards to domain objects, I assume you are referring to @Entity instances based on your comment.  I would generally not make my @Entity instances Seam components as this does not provide much benefit IMO.  @Entity instances are not intercepted and are not bijected.  It is not necessary to make an @Entity a Seam component to outject it to the context.

The following quote is from the Seam Documentation:

&lt;blockquote cite=&quot;Seam Documentation&quot;&gt;Because entities have a persistent identity in addition to their contextual identity, entity instances are usually bound explicitly in Java code, rather than being instantiated implicitly by Seam.&lt;/blockquote&gt;

If the Entity was instantiated implicitly by Seam the behavior you site is correct.  The Entity would be bound to the Conversation context.

&lt;blockquote cite=&quot;YourKnowWho&quot;&gt;
B. ... You can still expose the UserProfile as a conversation-scoped variable using SEAM @Roles and @Role annotation. You could also provide a POJO which is conversation-scoped and has the UserProfile object in session scope injected into it.
&lt;/blockquote&gt;

Yes, you certainly can.  This type of behavior is very desirable especially if you want to develop a user administration portion of your application for instance.

&lt;blockquote cite=&quot;YourKnowWho&quot;&gt;
C. Another way to test the code presented towards the end could be to create a UserProfileDAO with precedence level of MOCK and hook ...
&lt;/blockquote&gt;

Absolutely, this is the general approach and is always an option.  However if I want to test my component in isolation, it is quite simple to test if I only have to provide the domain object it is looking for rather than having to create a mock that provides that object.</description>
		<content:encoded><![CDATA[<p>Thanks for the comments, keep them coming as well <img src='http://solutionsfit.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<blockquote cite="YourKnowWho"><p>
A. &#8230; In that case, if they were SEAM components, they will by default be in CONVERSATION scope. In cases where the domain object is needed only in specific sections (or pages) of the application, one can very well make the domain object conversation scope. However, that also means that the pages involved have to use the same conversation which may or may not be the case.
</p></blockquote>
<p>You should definitely always consider the scope you are outjecting to.  In regards to domain objects, I assume you are referring to @Entity instances based on your comment.  I would generally not make my @Entity instances Seam components as this does not provide much benefit IMO.  @Entity instances are not intercepted and are not bijected.  It is not necessary to make an @Entity a Seam component to outject it to the context.</p>
<p>The following quote is from the Seam Documentation:</p>
<blockquote cite="Seam Documentation"><p>Because entities have a persistent identity in addition to their contextual identity, entity instances are usually bound explicitly in Java code, rather than being instantiated implicitly by Seam.</p></blockquote>
<p>If the Entity was instantiated implicitly by Seam the behavior you site is correct.  The Entity would be bound to the Conversation context.</p>
<blockquote cite="YourKnowWho"><p>
B. &#8230; You can still expose the UserProfile as a conversation-scoped variable using SEAM @Roles and @Role annotation. You could also provide a POJO which is conversation-scoped and has the UserProfile object in session scope injected into it.
</p></blockquote>
<p>Yes, you certainly can.  This type of behavior is very desirable especially if you want to develop a user administration portion of your application for instance.</p>
<blockquote cite="YourKnowWho"><p>
C. Another way to test the code presented towards the end could be to create a UserProfileDAO with precedence level of MOCK and hook &#8230;
</p></blockquote>
<p>Absolutely, this is the general approach and is always an option.  However if I want to test my component in isolation, it is quite simple to test if I only have to provide the domain object it is looking for rather than having to create a mock that provides that object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: YourKnowWho</title>
		<link>http://solutionsfit.com/blog/2007/12/20/contextual-injection-of-core-domain-concepts-with-seam/comment-page-1/#comment-46</link>
		<dc:creator>YourKnowWho</dc:creator>
		<pubDate>Fri, 21 Dec 2007 05:58:36 +0000</pubDate>
		<guid isPermaLink="false">http://solutionsfit.com/blog/2007/12/20/contextual-injection-of-core-domain-concepts-with-seam/#comment-46</guid>
		<description>Jacob,

Once again, the blog above is a piece of art.  So, keep them coming. And now, time for the comments.

A. In most J2EE applications that use databases, core domain objects tend to be persistent domain objects. In that case, if they were SEAM components, they will by default be in CONVERSATION scope.  In cases where the domain object is needed only in specific sections (or pages) of the application, one can very well make the domain object conversation scope.  However, that also means that the pages involved have to use the same conversation which may or may not be the case.  

B.  If the UserProfile object was being populated with roles and authentication information obtained from an external authentication mechanism like LDAP etc, then you most certainly would want to put the UserProfile object in SESSION scope to avoid repetitive calls to LDAP or prompting the user to login each time.  You can still expose the UserProfile as a conversation-scoped variable using SEAM @Roles and @Role annotation.  You could also provide a POJO which is conversation-scoped and has the UserProfile object in session scope injected into it.

C. Another way to test the code presented towards the end could be to create a UserProfileDAO with precedence level of MOCK and hook .  Thisi way, you can ensure that your SEAM annotations have been specified correctly.</description>
		<content:encoded><![CDATA[<p>Jacob,</p>
<p>Once again, the blog above is a piece of art.  So, keep them coming. And now, time for the comments.</p>
<p>A. In most J2EE applications that use databases, core domain objects tend to be persistent domain objects. In that case, if they were SEAM components, they will by default be in CONVERSATION scope.  In cases where the domain object is needed only in specific sections (or pages) of the application, one can very well make the domain object conversation scope.  However, that also means that the pages involved have to use the same conversation which may or may not be the case.  </p>
<p>B.  If the UserProfile object was being populated with roles and authentication information obtained from an external authentication mechanism like LDAP etc, then you most certainly would want to put the UserProfile object in SESSION scope to avoid repetitive calls to LDAP or prompting the user to login each time.  You can still expose the UserProfile as a conversation-scoped variable using SEAM @Roles and @Role annotation.  You could also provide a POJO which is conversation-scoped and has the UserProfile object in session scope injected into it.</p>
<p>C. Another way to test the code presented towards the end could be to create a UserProfileDAO with precedence level of MOCK and hook .  Thisi way, you can ensure that your SEAM annotations have been specified correctly.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
