<?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>
	<lastBuildDate>Wed, 25 Nov 2009 12:11:42 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</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-9578</link>
		<dc:creator>Avrom</dc:creator>
		<pubDate>Tue, 29 Sep 2009 21:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.avromroyfaderman.com/?p=80#comment-9578</guid>
		<description>Hi Mark,

Unfortunately, this doesn&#039;t really satisfy the &quot;reusability&quot; criterion for the approach I mention. You have to write your Java code for every separate stored function your application needs to call. The idea here is (unlike the method outlined in the JDev documentation) to eliminate this-case-only Java coding.

Also, and more importantly, this really only works to retrieve scalar values. This article is actually about data sink, and its &lt;a href=&quot;http://www.avromroyfaderman.com/2008/10/the-power-of-properties-ii-the-view-object/&quot; rel=&quot;nofollow&quot;&gt;sequel&lt;/a&gt; is about retrieving result sets, not scalar values (I do think something like what you suggest, possibly generalized in some way, would be a good way to retrieve scalar values from DB functions).

Finally, by bypassing view and entity objects, you lose a lot of what business components provides: Cache management (especially management of large numbers of sessions), declarative validation, the ability to have multiple query collections corresponding to different data filters, the ability to have multiple, synchronized iterators over data, and so on. By using existing component types, and simply changing the way they retrieve/sink data, you can retain all of this other functionality.
</description>
		<content:encoded><![CDATA[<p>Hi Mark,</p>
<p>Unfortunately, this doesn&#8217;t really satisfy the &#8220;reusability&#8221; criterion for the approach I mention. You have to write your Java code for every separate stored function your application needs to call. The idea here is (unlike the method outlined in the JDev documentation) to eliminate this-case-only Java coding.</p>
<p>Also, and more importantly, this really only works to retrieve scalar values. This article is actually about data sink, and its <a href="http://www.avromroyfaderman.com/2008/10/the-power-of-properties-ii-the-view-object/" rel="nofollow">sequel</a> is about retrieving result sets, not scalar values (I do think something like what you suggest, possibly generalized in some way, would be a good way to retrieve scalar values from DB functions).</p>
<p>Finally, by bypassing view and entity objects, you lose a lot of what business components provides: Cache management (especially management of large numbers of sessions), declarative validation, the ability to have multiple query collections corresponding to different data filters, the ability to have multiple, synchronized iterators over data, and so on. By using existing component types, and simply changing the way they retrieve/sink data, you can retain all of this other functionality.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Malakanov</title>
		<link>http://www.avromroyfaderman.com/2008/07/the-power-of-properties/comment-page-1/#comment-9577</link>
		<dc:creator>Mark Malakanov</dc:creator>
		<pubDate>Tue, 29 Sep 2009 20:20:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.avromroyfaderman.com/?p=80#comment-9577</guid>
		<description>Hi Avrom.
Thanks for the article. It show other capabilities of ADF.
However it is possible to call PL/SQL (and other) stored procedures and functions using mostly declarative approach. Yes, some java coding is required.
1. create Application Module Implementation class (using App Module form, Java tab)
2. add your custom java method, that calls a stored PL/SQL executable.
3. register Client Interface for this custom java method (using again App Module form, Java tab)
4. After that you can see it in Data Controls. Drop that on a form as a button or a method.
5. specify where to get parameters values from (using Edit Bindings for that control) 

example of java method

AppModuleImpl.java
...
public class AppModuleImpl extends ApplicationModuleImpl .....
...

    public String adf_test_func(int num, String varch){
        try {
            //Connection conn = this.getDBTransaction().
            //    createPreparedStatement(&quot;begin null; end;&quot;,1).getConnection();
            
            CallableStatement cs = this.getDBTransaction().
                    createCallableStatement(&quot;begin ? := ADF_TEST_FUNC(?,?); end;&quot;,0);
            cs.registerOutParameter(1, Types.VARCHAR);
            cs.setInt(2,num);
            cs.setString(3,varch);
            cs.execute();
            String retValue = cs.getString(1);
            return retValue;
        }
        catch (SQLException ex){
            throw new JboException(ex);
        }
    }

thanks,
Mark Malakanov</description>
		<content:encoded><![CDATA[<p>Hi Avrom.<br />
Thanks for the article. It show other capabilities of ADF.<br />
However it is possible to call PL/SQL (and other) stored procedures and functions using mostly declarative approach. Yes, some java coding is required.<br />
1. create Application Module Implementation class (using App Module form, Java tab)<br />
2. add your custom java method, that calls a stored PL/SQL executable.<br />
3. register Client Interface for this custom java method (using again App Module form, Java tab)<br />
4. After that you can see it in Data Controls. Drop that on a form as a button or a method.<br />
5. specify where to get parameters values from (using Edit Bindings for that control) </p>
<p>example of java method</p>
<p>AppModuleImpl.java<br />
&#8230;<br />
public class AppModuleImpl extends ApplicationModuleImpl &#8230;..<br />
&#8230;</p>
<p>    public String adf_test_func(int num, String varch){<br />
        try {<br />
            //Connection conn = this.getDBTransaction().<br />
            //    createPreparedStatement(&#8221;begin null; end;&#8221;,1).getConnection();</p>
<p>            CallableStatement cs = this.getDBTransaction().<br />
                    createCallableStatement(&#8221;begin ? := ADF_TEST_FUNC(?,?); end;&#8221;,0);<br />
            cs.registerOutParameter(1, Types.VARCHAR);<br />
            cs.setInt(2,num);<br />
            cs.setString(3,varch);<br />
            cs.execute();<br />
            String retValue = cs.getString(1);<br />
            return retValue;<br />
        }<br />
        catch (SQLException ex){<br />
            throw new JboException(ex);<br />
        }<br />
    }</p>
<p>thanks,<br />
Mark Malakanov</p>
]]></content:encoded>
	</item>
	<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&#039;s not one instance per session, that&#039;s one instance, period. So if you set a property on your EntityDefImpl instance, that&#039;s going to affect all users of the application.

If you&#039;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 &quot;mypackage.MyEntityDefName_MyProperty&quot;) 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() + &#039;_&#039; + 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>
