<?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: The Power of Properties</title>
	<atom:link href="http://www.avromroyfaderman.com/2008/07/the-power-of-properties/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.avromroyfaderman.com/2008/07/the-power-of-properties/</link>
	<description>Tricks, Tips, Thoughts, and Rants About Java EE, Oracle ADF, and Web Application Development</description>
	<pubDate>Wed, 07 Jan 2009 16:49:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Avrom</title>
		<link>http://www.avromroyfaderman.com/2008/07/the-power-of-properties/comment-page-1/#comment-2435</link>
		<dc:creator>Avrom</dc:creator>
		<pubDate>Sat, 04 Oct 2008 19:20:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.avromroyfaderman.com/?p=80#comment-2435</guid>
		<description>Yes, you can, by calling EntityDefImpl.setProperty(). However, you need to be very careful with this. Each entity object definition in an application has a *single* instance. That's not one instance per session, that's one instance, period. So if you set a property on your EntityDefImpl instance, that's going to affect all users of the application.

If you're interested in setting properties per entity object definition per user, the easiest way is probably to store them, with a key that indicates both the definition and the property (e.g., the string "mypackage.MyEntityDefName_MyProperty") on the Hashtable returned by ApplicationModuleImpl.getSession().getUserData() for your application module. Then, create a method on your EntityObjectImpl custom framework subclass (assuming you need to use this property within particular EO instances, even though you want to store it once) like so:

public (or protected) Object getCustomProperty(String propName) {
    Hashtable properties = getDBTransaction().getSession().getUserData();
    String propKey = getEntityDef().getFullName() + '_' + propName;
    return properties.get(propKey);
}
</description>
		<content:encoded><![CDATA[<p>Yes, you can, by calling EntityDefImpl.setProperty(). However, you need to be very careful with this. Each entity object definition in an application has a *single* instance. That&#8217;s not one instance per session, that&#8217;s one instance, period. So if you set a property on your EntityDefImpl instance, that&#8217;s going to affect all users of the application.</p>
<p>If you&#8217;re interested in setting properties per entity object definition per user, the easiest way is probably to store them, with a key that indicates both the definition and the property (e.g., the string &#8220;mypackage.MyEntityDefName_MyProperty&#8221;) on the Hashtable returned by ApplicationModuleImpl.getSession().getUserData() for your application module. Then, create a method on your EntityObjectImpl custom framework subclass (assuming you need to use this property within particular EO instances, even though you want to store it once) like so:</p>
<p>public (or protected) Object getCustomProperty(String propName) {<br />
    Hashtable properties = getDBTransaction().getSession().getUserData();<br />
    String propKey = getEntityDef().getFullName() + &#8216;_&#8217; + propName;<br />
    return properties.get(propKey);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ubernetizen</title>
		<link>http://www.avromroyfaderman.com/2008/07/the-power-of-properties/comment-page-1/#comment-2425</link>
		<dc:creator>ubernetizen</dc:creator>
		<pubDate>Sat, 04 Oct 2008 11:48:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.avromroyfaderman.com/?p=80#comment-2425</guid>
		<description>Nice article!One follow up query..can we also define such properties on the fly during runtime ?</description>
		<content:encoded><![CDATA[<p>Nice article!One follow up query..can we also define such properties on the fly during runtime ?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
