<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>demetrio.it blog &#187; programming</title>
	<atom:link href="http://blog.demetrio.it/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.demetrio.it</link>
	<description>nessun limite all'immaginazione</description>
	<lastBuildDate>Thu, 15 Jul 2010 15:42:55 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JSF 2.0 Cookbook: book review!</title>
		<link>http://blog.demetrio.it/2010/07/15/jsf-2-0-cookbook-book-review/</link>
		<comments>http://blog.demetrio.it/2010/07/15/jsf-2-0-cookbook-book-review/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 15:41:55 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[book review]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[JSF 2.0 Cookbook]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=216</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Hello,<br />
Packt Publishing asked me to review the book <a href="https://www.packtpub.com/jsf-2-0-cookbook/book" target="_blank">JSF 2.0 Cookbook</a>. I&#8217;ll post a detailed review after I finish reading it.</p>
<p>In the meantime go and have a look to what the book is offering:</p>
<p><a href="https://www.packtpub.com/jsf-2-0-cookbook/book" target="_blank"><img style="border: none;" src="http://blog.demetrio.it/wp-content/uploads/JSF_2.0-243x300.jpg" alt="" /></a></p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/07/15/jsf-2-0-cookbook-book-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RichFaces editor: move the caret position at the end after a reRender</title>
		<link>http://blog.demetrio.it/2010/02/12/richfaces-editor-move-the-caret-position-at-the-end-after-a-rerender/</link>
		<comments>http://blog.demetrio.it/2010/02/12/richfaces-editor-move-the-caret-position-at-the-end-after-a-rerender/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 20:28:41 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[move caret]]></category>
		<category><![CDATA[position]]></category>
		<category><![CDATA[rich]]></category>
		<category><![CDATA[richfaces]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=194</guid>
		<description><![CDATA[Some times it can happen you need to re-render a block that includes the RichFaces editor: if the user is using to edit a piece of text, after the re-rendering the caret goes back to the first place so if the user were writing he&#8217;d have to manually move it every time it happens.
The solution [...]]]></description>
			<content:encoded><![CDATA[<p>Some times it can happen you need to re-render a block that includes the RichFaces editor: if the user is using to edit a piece of text, after the re-rendering the caret goes back to the first place so if the user were writing he&#8217;d have to manually move it every time it happens.</p>
<p>The solution to this problem (that you can use also for other purposes) is a javascript piece of code found on the TinyMCE forum, adapted for the RichFaces specific case:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #003366; font-weight: bold;">function</span> moveCaretToTheEnd<span style="color: #009900;">&#40;</span>editor_jsf_id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> editor_id <span style="color: #339933;">=</span> editor_jsf_id <span style="color: #339933;">+</span> <span style="color: #3366CC;">'TextArea'</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> ed <span style="color: #339933;">=</span> tinyMCE.<span style="color: #660066;">getInstanceById</span><span style="color: #009900;">&#40;</span>editor_id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> root <span style="color: #339933;">=</span> ed.<span style="color: #660066;">dom</span>.<span style="color: #660066;">getRoot</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">// This gets the root node of the editor window</span>
        <span style="color: #003366; font-weight: bold;">var</span> lastnode <span style="color: #339933;">=</span> root.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>root.<span style="color: #660066;">childNodes</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>tinymce.<span style="color: #660066;">isGecko</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">// But firefox places the selection outside of that tag, so we need to go one level deeper:</span>
            lastnode <span style="color: #339933;">=</span> lastnode.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>lastnode.<span style="color: #660066;">childNodes</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #006600; font-style: italic;">// Now, we select the node</span>
        ed.<span style="color: #660066;">selection</span>.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span>lastnode<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// And collapse the selection to the end to put the caret there:</span>
        ed.<span style="color: #660066;">selection</span>.<span style="color: #660066;">collapse</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The only change I had to do is on the first line of the script as the id of the component we have to pass to get the editor instance is <componentId>+&#8221;TextArea&#8221; so I had to compose the id passed to the js function with the &#8220;TextArea&#8221; string.</p>
<p>To discover the id of the component we can use the built-in RichFaces function <em>rich:clientId</em> in this way (example in a poll component):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:poll</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;currentChatMsgs,recipientList,threadFoldedSection&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">oncomplete</span>=<span style="color: #ff0000;">&quot;moveCaretToTheEnd('#{rich:clientId('myEditorJsfId')}')&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">enabled</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Demetrio Filocamo</p>
<p>&#8212;&#8212;</p>
<p>JBoss RichFaces 3.3 (book) &#8211; <a href="http://www.packtpub.com/jboss-richfaces-3-3">http://www.packtpub.com/jboss-richfaces-3-3</a></p>
<p>Learn RichFaces step by step developing a sample application.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/02/12/richfaces-editor-move-the-caret-position-at-the-end-after-a-rerender/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RichFaces editor: how to intercept the &#8220;return&#8221; key to submit a form</title>
		<link>http://blog.demetrio.it/2010/02/12/richfaces-editor-how-to-intercept-the-return-key-to-submit-a-form/</link>
		<comments>http://blog.demetrio.it/2010/02/12/richfaces-editor-how-to-intercept-the-return-key-to-submit-a-form/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 19:06:35 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[intercept]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[onkeypress]]></category>
		<category><![CDATA[return key]]></category>
		<category><![CDATA[rich]]></category>
		<category><![CDATA[richfaces]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=156</guid>
		<description><![CDATA[Hello,
I&#8217;ll try to write more on my blog and keep you update about every technique I use and that can be very useful to you as well.
Today I needed to submit a form with an editor element when the user pressed the &#8220;return&#8221; key (instead of creating a new line).
The code is not so complicate [...]]]></description>
			<content:encoded><![CDATA[<p>Hello,<br />
I&#8217;ll try to write more on my blog and keep you update about every technique I use and that can be very useful to you as well.</p>
<p>Today I needed to submit a form with an editor element when the user pressed the &#8220;return&#8221; key (instead of creating a new line).</p>
<p>The code is not so complicate but as the rich:editor uses the TinyMCE component you have to search all around to find the right way. Better to have a complete solution.</p>
<p>It consists on creating an handler onKeyPress and call a javascript function (created by a:jsFunction) to submit our form. Simpler doing then saying it.</p>
<p>Let&#8217;s start by including the editor in the standard way (form, editor, submit button):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rich:editor</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>I&#8217;ve kept it simple (stripped out all the params and attribute I use) to target only our problem.</p>
<p>Let&#8217;s define a javascript function handler for our use case:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #003366; font-weight: bold;">function</span> returnSubmit<span style="color: #009900;">&#40;</span>ed<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ed.<span style="color: #660066;">onKeyPress</span>.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ed<span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> keyCode <span style="color: #339933;">=</span> e.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">which</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">charCode</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>keyCode <span style="color: #339933;">==</span> <span style="color: #CC0000;">13</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">// My return key handler code here </span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The <em>ed</em> variable will be passed by the editor; let&#8217;s configure our new function to the onsetup editor event:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rich:editor</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">onsetup</span>=<span style="color: #ff0000;">&quot;returnSubmit(ed)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Now we have a function that is called for each keyPress event, and inside it we can execute something on &#8220;return&#8221; key press.</p>
<p>What we have to do is to submit the form, the best way is to create an Ajax javascript function using a:jsFunction: in this way we can do standard Ajax updates also reRendering elements, submitting params and all the thing we are used to <img src='http://blog.demetrio.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Let&#8217;s create the function:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rich:editor</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">onsetup</span>=<span style="color: #ff0000;">&quot;returnSubmit(ed)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:jsFunction</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;submitForm&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Now we have to insert it into the handler and it&#8217;s done!</p>
<p>Here it is the whole code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #003366; font-weight: bold;">function</span> returnSubmit<span style="color: #009900;">&#40;</span>ed<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ed.<span style="color: #660066;">onKeyPress</span>.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ed<span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> keyCode <span style="color: #339933;">=</span> e.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">which</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">charCode</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>keyCode <span style="color: #339933;">==</span> <span style="color: #CC0000;">13</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">// My return key handler code here </span>
                submitForm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rich:editor</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">onsetup</span>=<span style="color: #ff0000;">&quot;returnSubmit(ed)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:jsFunction</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;submitForm&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><strong>Another tip</strong><br />
If with the js function you reRender components, do some action, set some property etc., to avoid duplication of code in the commandButton you can use the same js function into the button using the <em>onclick</em> attribute:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rich:editor</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">onsetup</span>=<span style="color: #ff0000;">&quot;returnSubmit(ed)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">&quot;submitForm();&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:jsFunction</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;submitForm&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">action</span>=<span style="color: #ff0000;">&quot;#{myBean.myAction}&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">oncomplete</span>=<span style="color: #ff0000;">&quot;doSomething();&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;first,second&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;f:setPropertyActionListener</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;valueToSet&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;#{myBean.firstValue}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a:jsFunction<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Demetrio Filocamo</p>
<p>&#8212;&#8212;</p>
<p>JBoss RichFaces 3.3 (book) &#8211; <a href="http://www.packtpub.com/jboss-richfaces-3-3">http://www.packtpub.com/jboss-richfaces-3-3</a></p>
<p>Learn RichFaces step by step developing a sample application.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/02/12/richfaces-editor-how-to-intercept-the-return-key-to-submit-a-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JBoss RichFaces 3.3 &#8211; Introduction</title>
		<link>http://blog.demetrio.it/2010/02/12/jboss-richfaces-3-3-introduction/</link>
		<comments>http://blog.demetrio.it/2010/02/12/jboss-richfaces-3-3-introduction/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 02:49:19 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[richfaces]]></category>
		<category><![CDATA[slides]]></category>
		<category><![CDATA[slideshare]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=153</guid>
		<description><![CDATA[An introduction to JBoss RichFaces framework and to the book JBoss RichFaces (Packt) by Demetrio Filocamo.
RichFaces is a very useful open source framework that allows you to add Ajax capability to your JSF application (using the standard JSF components) without the need to write JavaScript code and manage JavaScript compatibility between browsers.
You can read more [...]]]></description>
			<content:encoded><![CDATA[<p>An introduction to JBoss RichFaces framework and to the book JBoss RichFaces (Packt) by Demetrio Filocamo.</p>
<p>RichFaces is a very useful open source framework that allows you to add Ajax capability to your JSF application (using the standard JSF components) without the need to write JavaScript code and manage JavaScript compatibility between browsers.</p>
<p>You can read more about the book here: <a href="http://www.packtpub.com/jboss-richfaces-3-3">http://www.packtpub.com/jboss-richfaces-3-3</a></p>
<div id="__ss_3143676" style="width: 425px; text-align: left;"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" title="JBoss RichFaces 3.3 - Introduction" href="http://www.slideshare.net/demetrio812/jboss-richfaces-33-introduction">JBoss RichFaces 3.3 &#8211; Introduction</a><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=slidesintroduction-100211203450-phpapp02&amp;stripped_title=jboss-richfaces-33-introduction" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=slidesintroduction-100211203450-phpapp02&amp;stripped_title=jboss-richfaces-33-introduction" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/demetrio812">Demetrio Filocamo</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/02/12/jboss-richfaces-3-3-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New book: JSF 1.2 Components</title>
		<link>http://blog.demetrio.it/2010/02/12/new-book-jsf-1-2-components/</link>
		<comments>http://blog.demetrio.it/2010/02/12/new-book-jsf-1-2-components/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 01:02:27 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[jsf]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=146</guid>
		<description><![CDATA[Hi guys,
I&#8217;m going to read and then review for Packt Publishing the new book JSF 1.2 Components by lan Hlavats, the developer behing JSF ToolBox for Dreamweaver. The book is about the most important JSF component frameworks we can use to empower our application. So starting from the Standard JSF Components we&#8217;ll go through Facelets, [...]]]></description>
			<content:encoded><![CDATA[<p>Hi guys,<br />
I&#8217;m going to read and then review for Packt Publishing the new book<strong> JSF 1.2 Components </strong>by <strong>lan Hlavats</strong>, the developer behing <em>JSF ToolBox for Dreamweaver</em>. The book is about the most important JSF component frameworks we can use to empower our application. So starting from the <strong>Standard JSF Components</strong> we&#8217;ll go through <strong>Facelets</strong>, <strong>Apache Tomahawk</strong>, <strong>Apache Trinidad</strong>, <strong>ICEfaces</strong>,<strong> JBoss Seam JSF Components</strong> and <strong>JBoss RichFaces</strong>.</p>
<p>It is also technically reviewed by very know guys on JSF field like <strong>Cagatay Civici</strong> (PMC member of open source JSF implementation Apache MyFaces and the project leader of popular PrimeFaces framework), <strong>Ted Goddard</strong> (Chief Software Architect at ICEsoft Technologies and is the technical leader for ICEfaces), <strong>Kito D. Mann</strong> (editor-in-chief of JSF Central &#8211; www.jsfcentral.com &#8211; and the author of JavaServer Faces in Action &#8211; Manning) and others.</p>
<p>I&#8217;ll come back soon with something to say, in the meantime you can download the sample chapter about the <em>Facelets Components</em> by clicking <a href="http://blog.demetrio.it/wp-content/uploads/7627-developing-jsf-components-sample-chapter-2-facelets-components.pdf">here</a>, or buy the book from the <a href="http://www.packtpub.com/jsf-1-2-components-develop-advanced-ajax-enabled-applications/book/mid/090210c140fp?utm_source=demetrio.it&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_002394" target="_blank">Packt website</a>!</p>
<p>Thanks</p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/02/12/new-book-jsf-1-2-components/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JBoss RichFaces 3.3 &#8211; My book has been published!</title>
		<link>http://blog.demetrio.it/2009/11/07/jboss-richfaces-3-3/</link>
		<comments>http://blog.demetrio.it/2009/11/07/jboss-richfaces-3-3/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 00:41:09 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[londra]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[3.3]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[demetrio]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[facelets]]></category>
		<category><![CDATA[filocamo]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[manual]]></category>
		<category><![CDATA[packt]]></category>
		<category><![CDATA[richfaces]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[seam]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=131</guid>
		<description><![CDATA[Hi all,
the book I&#8217;ve worked on the last months has finally been published!!

JBoss RichFaces is a rich component library for JavaServer Faces and an AJAX framework that allows easy integration of Ajax capabilities into complex business applications. Do you wish to eliminate the time involved in writing JavaScript code and managing JavaScript-compatibility between browsers to [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,<br />
<strong>the book I&#8217;ve worked on the last months has finally been published!!</strong></p>
<p style="text-align: center;"><a title="JBoss RichFaces 3.3" rel="lightbox[pics131]" href="http://blog.demetrio.it/wp-content/uploads/JBoss-RichFaces.jpg"><img class="attachment wp-att-133 aligncenter" src="http://blog.demetrio.it/wp-content/uploads/JBoss-RichFaces.jpg" alt="JBoss RichFaces 3.3" width="300" height="370" /></a></p>
<p style="text-align: left;">JBoss RichFaces is a rich component library for JavaServer Faces and an AJAX framework that allows easy integration of Ajax capabilities into complex business applications. Do you wish to eliminate the time involved in writing JavaScript code and managing JavaScript-compatibility between browsers to build an Ajax web application quickly?</p>
<p>This book goes beyond the documentation to teach you how to do that. It will show you how to get the most out of JBoss RichFaces by explaining the key components and how you can use them to enhance your applications. Most importantly, you will learn how to integrate Ajax into your applications without using JavaScript, but only standard JSF components. You will learn how to create and customize your own components and add them to your new or existing applications.</p>
<p>First, the book introduces you to JBoss RichFaces and its components. It uses many examples of Ajax components which, among others, include: Calendar, Data Table, ToolTip, ToolBar, Menu, RichEditor, and Drag &#8216;n&#8217; Drop. All these components will help you create the web site you always imagined. Key aspects of the RichFaces framework such as the Ajax framework, skinnability, and Component Development Kit (CDK) will help you customize the look of your web application. As you progress through the book, you will see a sample application that shows you how to build an advanced contact manager. You&#8217;re also going to be amazed to know about the advanced topics you will learn such as developing new components, new skins, optimizing a web application, inserting components dynamically using Java instead of XHTML, and using JavaScript to manage components. This book is more than a reference with component example code: it&#8217;s a manual that will guide you, step by step, through the development of a real Ajax JSF web application.</p>
<p><strong>What This Book Covers</strong></p>
<ul>
<li>Chapter 1: <em>What is RichFaces</em> covers the aims of the RichFaces framework, its components, and what you can do by using it in a web application.</li>
<li>Chapter 2: <em>Getting Ready</em> explains how to configure your environment by creating a simple project using the seam-gen tool, adding support to Seam and Facelets, and the manual configuration for the RichFaces libraries. We will understand the IDE that we can use while developing with the framework.</li>
<li>In Chapter 3: <em>First Steps</em>, you will learn to build Ajax applications by developing a simple example, the basics of RichFaces step by step, from creating the project to editing the code, using very important components and their Ajax properties.</li>
<li>Chapter 4:<em> The Application</em> covers how to create the basics of our project by having a look at the side technologies we might know, in order to build good applications. It will cover templating with Facelets, JBoss Seam authentication, and customization of the entities.</li>
<li>Chapter 5: <em>Making the Application Structure</em> explains us how to create the login and registration system of the website. We&#8217;ll look at all the features that a real application might have.</li>
<li>In Chapter 6: <em>Making the Contacts List and Detail</em>, we will develop the core feature of our application—contact management. We&#8217;ll learn about Ajax interaction and containers, and about new Ajax components that RichFaces offers.</li>
<li>Chapter 7: <em>Finishing the Application</em> explains how to finish building the application using the RichFaces components, and about customizing them.</li>
<li>In Chapter 8: <em>Skin Customization</em>, we&#8217;ll see all the powerful customization capabilities that the RichFaces framework offers.</li>
<li>Chapter 9: <em>Creating a New plug &#8216;n&#8217; skin</em> covers how to create, customize, and package and deploy a new pluggable skin.</li>
<li>Chapter 10: <em>Advanced Techniques</em> explains you how to use and implement pushing, partial updates, and session expiration handling in order to develop advanced applications.</li>
<li>In Chapter 11: <em>Component Development Kit</em>, we&#8217;ll see how to start a project in order to develop a simple JSF Ajax component in a simple and effective way using the features the CDK offers.</li>
<li>Appendix: <em>RichFaces Components Overview</em> covers a list of all the components of RichFaces with their functionalities.</li>
</ul>
<p><strong>Example chapter</strong><br />
You can download a sample chapter, Chapter 8: <em>Skin Customization</em>,  by clicking <a href="http://blog.demetrio.it/wp-content/uploads/Chapter-8-Skin-Customization.pdf">here</a>.</p>
<p><strong>Where to buy it</strong><br />
You can buy JBoss RichFaces 3.3 from the <a href="http://www.packtpub.com/jboss-richfaces-3-3/mid/031109dmdusq?utm_source=Blog.demetrio.it&#038;utm_medium=affiliate&#038;utm_content=authorsite&#038;utm_campaign=mdb_001309" target="_blank">Packt Publishing website</a>.</p>
<p>Free shipping to the US, UK, Europe and selected Asian countries. For more information, please read the <a href="http://www.packtpub.com/Shippingpolicy" target="_blank">Packt Publishing shipping policy</a>.<br />
Alternatively, you can buy the book from Amazon, BN.com, Computer Manuals and most internet book retailers.</p>
<p>Thank you!</p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2009/11/07/jboss-richfaces-3-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding Cache support to a seam-gen generated EAR project</title>
		<link>http://blog.demetrio.it/2009/04/03/adding-cache-support-to-a-seam-gen-generated-ear-project/</link>
		<comments>http://blog.demetrio.it/2009/04/03/adding-cache-support-to-a-seam-gen-generated-ear-project/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 00:08:33 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[ear]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss cache]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[seam]]></category>
		<category><![CDATA[seam-gen]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=110</guid>
		<description><![CDATA[Adding Cache support to a Seam project (Seam 2.1.x) it&#8217;s very simple and it is described in the official Seam developer documentation, anyways it doesn&#8217;t explain the exact steps to accomplish the task into an EAR project, I&#8217;m writing them to make your life even more simple  

Add treecache.xml (you can find it into the [...]]]></description>
			<content:encoded><![CDATA[<p>Adding Cache support to a Seam project (Seam 2.1.x) it&#8217;s very simple and it is described in the<a title="JBoss Seam Cache documentation" href="http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/cache.html" target="_blank"> official Seam developer documentation</a>, anyways it doesn&#8217;t explain the exact steps to accomplish the task into an EAR project, I&#8217;m writing them to make your life even more simple <img src='http://blog.demetrio.it/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<ul>
<li>Add treecache.xml (you can find it into the seam blog example) to /resources/META-INF/</li>
<li>Open build.xml for editing, go to the &#8220;ear&#8221; target and tell to copy the treecache.xml file:<br />
&lt;target name=&#8221;ear&#8221; description=&#8221;Build the EAR structure in a staging directory&#8221;&gt;<br />
&#8230;<br />
    &lt;copy todir=&#8221;${ear.dir}/META-INF&#8221;&gt;<br />
        &lt;fileset dir=&#8221;${basedir}/resources/META-INF&#8221;&gt;<br />
            &lt;include name=&#8221;application.xml&#8221;/&gt;<br />
            &lt;include name=&#8221;jboss-app.xml&#8221;/&gt;<br />
            &lt;include name=&#8221;seam-deployment.properties&#8221;/&gt;<br />
            &lt;include name=&#8221;treecache.xml&#8221;/&gt;<br />
        &lt;/fileset&gt;<br />
    &lt;/copy&gt;<br />
&lt;/target&gt;</li>
<li>Edit components.xml, add the following XMLNS:<br />
xmlns:cache=&#8221;http://jboss.com/products/seam/cache&#8221;The following schema location:<br />
http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.1.xsd </p>
<p>And the following declaration:<br />
&lt;cache:jboss-cache-provider configuration=&#8221;META-INF/treecache.xml&#8221; /&gt;</li>
<li>Edit deployed-jars-ear.list and add the required JARs, I used the JBoss Cache 1.x for JBoss AS 4.2.X:<br />
jboss-cache.jar<br />
jgroups.jarHere there is the <a href="http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/cache.html#d0e21178">list</a> of jars (and versions) for other configurations.</li>
</ul>
<p>And <a href="http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/cache.html#d0e21343">here</a> you find the way how to use it in your projects.</p>
<p>Hope you liked it.</p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2009/04/03/adding-cache-support-to-a-seam-gen-generated-ear-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One-to-one relationship with auto-generated key using JPA/Hibernate using annotations</title>
		<link>http://blog.demetrio.it/2009/04/03/one-to-one-relationship-with-auto-generated-key-using-jpahibernate-using-annotations/</link>
		<comments>http://blog.demetrio.it/2009/04/03/one-to-one-relationship-with-auto-generated-key-using-jpahibernate-using-annotations/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 01:18:52 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[auto generated key]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[one-to-one]]></category>
		<category><![CDATA[one2one]]></category>
		<category><![CDATA[seam]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=115</guid>
		<description><![CDATA[ 
Adding a one-to-one relationship with shared primary key can become a difficult task if the main table key is an auto-generated one.
Even the Hibernate Annotations documentation example only works with not auto-generated id, if you try to use an auto incremental id, for example, 
it&#8217;s impossible to persist the 2 tables at the same time.
Surfing on [...]]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>Adding a one-to-one relationship with shared primary key can become a difficult task if the main table key is an auto-generated one.</p>
<p>Even the Hibernate Annotations documentation example only works with not auto-generated id, if you try to use an auto incremental id, for example, </p>
<p>it&#8217;s impossible to persist the 2 tables at the same time.</p>
<p>Surfing on the net I&#8217;ve seen some ppl with this kind of problem (I suppose one-to-one relationships are not so common, don&#8217;t know why) and most of ppl use the foreign-key approach that works ok but it&#8217;s not clean from my point of view, so I wanted to find a solution for my case.</p>
<p>The original example from the Hibernate Annotations Documentation is:</p>
<p>@Entity<br />
public class Body {</p>
<p>    @Id<br />
    public Long getId() { return id; }</p>
<p>    @OneToOne(cascade = CascadeType.ALL)<br />
    @PrimaryKeyJoinColumn<br />
    public Heart getHeart() {<br />
        return heart;<br />
    }</p>
<p>    &#8230;</p>
<p>}</p>
<p> </p>
<p>@Entity<br />
public class Heart {</p>
<p>    @Id<br />
    public Long getId() { &#8230; }</p>
<p>}</p>
<p>As you can see this as not auto generated id and will not work just putting the <em>@GeneratedValue</em> annotation.</p>
<p>The final solution is:</p>
<p>@Entity<br />
public class Body {</p>
<p>    @Id<br />
    <strong>@GeneratedValue(strategy = IDENTITY)</strong><br />
    public Long getId() { return id; }</p>
<p>    @OneToOne(cascade = CascadeType.ALL)<br />
    @PrimaryKeyJoinColumn<br />
    public Heart getHeart() {<br />
        return heart;<br />
    }</p>
<p>    &#8230;</p>
<p>}</p>
<p>@Entity<br />
public class Heart {</p>
<p>    @Id<br />
<strong>    @GeneratedValue(generator=&#8221;foreign&#8221;) <br />
    @GenericGenerator(name=&#8221;foreign&#8221;, strategy = &#8220;foreign&#8221;, parameters = {@Parameter(name=&#8221;property&#8221;, value=&#8221;body&#8221;)})<br />
<span style="font-weight: normal; ">    public Long getId() { &#8230;}</span></strong></p>
<p><strong>    @OneToOne(mappedBy=&#8221;heart&#8221;)<br />
    public Body getBody() { &#8230; }</strong></p>
<p>}</p>
<div>Now all works fine for me.</div>
<div>Thanks</div>
<div>Demetrio</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2009/04/03/one-to-one-relationship-with-auto-generated-key-using-jpahibernate-using-annotations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate hbm2java and generated BigDecimal from MySQL decimal(10,2) type</title>
		<link>http://blog.demetrio.it/2009/02/02/hibernate-hbm2java-and-generated-bigdecimal-from-mysql-decimal102-type/</link>
		<comments>http://blog.demetrio.it/2009/02/02/hibernate-hbm2java-and-generated-bigdecimal-from-mysql-decimal102-type/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 12:19:12 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[java mysql seam jpa bigdecimal decimal hbm2java tips]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=106</guid>
		<description><![CDATA[I had a little problem while working on a JBoss Seam project: I used the MySQL decimal(10,2) type for price value but, while running seam tests, the hbm2ddl schema validator gave me this error:
Caused by: org.hibernate.HibernateException: Wrong column type: shippingCost, expected: numeric(10,0)
[testng]     at org.hibernate.mapping.Table.validateColumns(Table.java:261)
[testng]     at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1083)
[testng]     at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
[testng]     at org.hibernate.impl.SessionFactoryImpl.&#60;init&#62;(SessionFactoryImpl.java:317)
[testng]     [...]]]></description>
			<content:encoded><![CDATA[<p>I had a little problem while working on a JBoss Seam project: I used the MySQL decimal(10,2) type for price value but, while running seam tests, the hbm2ddl schema validator gave me this error:</p>
<p style="padding-left: 30px;">Caused by: org.hibernate.HibernateException: Wrong column type: shippingCost, expected: numeric(10,0)<br />
[testng]     at org.hibernate.mapping.Table.validateColumns(Table.java:261)<br />
[testng]     at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1083)<br />
[testng]     at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)<br />
[testng]     at org.hibernate.impl.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:317)<br />
[testng]     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)<br />
[testng]     at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:918)<br />
[testng]     at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:656)<br />
[testng]     &#8230; 68 more</p>
<p>The problem is that hbm2java usa a wrong column definition for the entity property, in fact the @Column annotation on the property was:</p>
<p style="padding-left: 30px;">@Column(name = &#8220;shippingCost&#8221;, nullable = false, precision = 10)</p>
<p>The solution is simple, just change it to:</p>
<p style="padding-left: 30px;">@Column(name = &#8220;shippingCost&#8221;, nullable = false, precision = 10<strong>, scale=2, columnDefinition=&#8221;decimal(10,2)&#8221;</strong>)</p>
<p>Now the type is correctly defined and the schema validator doesn&#8217;t return any error.</p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2009/02/02/hibernate-hbm2java-and-generated-bigdecimal-from-mysql-decimal102-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cambiando argomento&#8230;</title>
		<link>http://blog.demetrio.it/2008/08/25/cambiando-argomento/</link>
		<comments>http://blog.demetrio.it/2008/08/25/cambiando-argomento/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 16:03:07 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[divertenti]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programmazione windows storia it ridere]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=88</guid>
		<description><![CDATA[Ho trovato questo post del 2001 sulla Programmazione Windows tra le mie cose salvate, è vecchio ma ancora divertente  
 
Breve storia della programmazione Windows
Al principio, c&#8217;erano le API di Windows e &#8220;l&#8217;inferno delle DLL&#8221;, che roba e&#8217;? direte voi, semplice! E&#8217; quella condizione per cui si installa un nuovo programma e 1) il programma non funziona e [...]]]></description>
			<content:encoded><![CDATA[<p>Ho trovato questo post del 2001 sulla Programmazione Windows tra le mie cose salvate, è vecchio ma ancora divertente <img src='http://blog.demetrio.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p> </p>
<h3>Breve storia della programmazione Windows</h3>
<p>Al principio, c&#8217;erano le API di Windows e &#8220;l&#8217;inferno delle DLL&#8221;, che roba e&#8217;? direte voi, semplice! E&#8217; quella condizione per cui si installa un nuovo programma e 1) il programma non funziona e 2) tutto il resto smette di funzionare. Questo perche&#8217; quel coglione che ha scritto l&#8217;installazione ha fatto in modo che questa sovrascrivesse 100 DLL di sistema che erano gia&#8217; presenti, mentre non ne ha sovrascritte altre 100.</p>
<p>Dopo un po&#8217; di tempo Microsoft invento&#8217; VERSIOINFO, cioe&#8217; la possibilita&#8217; di ficcare dentro la DLL un numero di versione che il programma di installazione fatto bene (nessuno quindi) dovrebbe verificare per evitare di sovrascrivere una DLL piu&#8217; nuova con una piu&#8217; vecchia. OOOOOOOHHHHH!!!!</p>
<p>Ma nello stesso tempo, un altro gruppo di sviluppo all&#8217;interno di Microsoft stessa scopri&#8217; un baco colossale nel DDE: che non lo avevano fatto loro! Cosi&#8217; inventarono OLE, che e&#8217; come il DDE, ma diverso, e proclamarono che l&#8217;OLE avrebbe risolto &#8220;l&#8217;inferno delle DLL&#8221;.</p>
<p>Ma poco tempo dopo, Microsoft &#8220;vide la luce&#8221; e le MFC emersero come soluzione ad ogni problema possibile immaginabile, be&#8217; OLE non se ne stette seduto sugli allori, cosi&#8217; riemerse come COM, che e&#8217; come OLE, ma diverso (!).</p>
<p>Ma un altro gruppo di sviluppatori Microsoft scopri&#8217; un baco colossale nelle MFC: non le avevano scritte loro! Essi procedettero a correggere il problema introducendo le ATL, che sono come le MFC, ma diverse, e nello stesso tempo si diedero da fare per nascondere tutti quei bei dettagli relativi a COM (o era OLE?) che il gruppo COM stava cercando di spiegarci.</p>
<p>Questo spinse il gruppo COM a cambiare nome, cosi&#8217; vide la luce ActiveX, che e&#8217; esattamente come OLE (o COM?) ma diverso, inoltre utilizza un&#8217;innovativo sistema di interfacce che (indovina un po&#8217;) elimina &#8220;l&#8217;inferno delle DLL&#8221;, non solo, ma rende anche il nostro codice scaricabile da Internet (insieme a tutti i virus dell&#8217;universo).</p>
<p>Come un figlio misconosciuto, il gruppo OS richiamo&#8217; l&#8217;attenzione sul nuovo nato: Cairo che nessuno riusci&#8217; mai a spiegare, lasciamo perdere poi produrre e distribuire. Nonostante cio&#8217; questi introdussero un&#8217;affascinante meccanismo di protezione dei file che era espressamente pensato per eliminare l&#8217;inferno delle DLL!</p>
<p>A questo punto pero&#8217;, il gruppo di sviluppo linguaggi scopri&#8217; un terribile errore in Java: non lo avevano fatto loro! Il rimedio fu la creazione di &#8220;J&#8221; o Jole o ActiveJ, che era come Java, ma diverso&#8230; tutto questo era molto eccitante, ma Sun apri&#8217; un contenzioso contro Microsoft sostenendo che c&#8217;e&#8217; un limite al quantitativo di schifezze che puoi rilasciare in un determinato tempo, e questo mise fine a &#8220;J&#8221; (o era Jole?).</p>
<p>Ovviamente tutto questo distolse l&#8217;attenzione da ActiveX (o era COM?), i quali pero&#8217; ritornarono alla ribalta con COM+ (ma non avrebbe dovuto essere ActiveX+?) ed MTS (che non ho mai capito perche&#8217; sia solo &#8216;MTS&#8217; e non abbia dentro un qualche &#8216;Active&#8217; o &#8216;+&#8217; o &#8216;COM&#8217;&#8230;).</p>
<p>Nello stesso tempo pero&#8217;, un altro gruppo se ne usci&#8217; con Windows DNA, che pero&#8217; scomparve prima che io avessi avuto il tempo di capire a che cosa era uguale pero&#8217; diverso&#8230;</p>
<p>Recentemente poi, Microsoft ha scoperto un altro terribile errore in Internet: che non lo hanno fatto loro! Ecco quindi la creazione di .NET, che e&#8217; come Internet, ma con piu&#8217; marketing. E che (sia chiaro questo) eliminera&#8217; l&#8217;inferno delle DLL! Inoltre introduce un bellissimo linguaggio detto C# (c&#8217;era un errore terribile in Java come detto prima), e distribuira&#8217; un bellissimo runtime che consentira&#8217; di eseguire i programmi (c&#8217;e&#8217; un errore terribile nel farlo fare alla CPU), inoltre include un esclusivo sistema di login centralizzato (c&#8217;e&#8217; un errore terribile nel non inserire tutte le vostre password in un server Microsoft) e che rivoluzionera&#8217; il modo di programmare&#8230;</p>
<p>Ma intanto, il gruppo OS e&#8217; ritornato alla ribalta, hanno scoperto un errore colossale in Windows NT: non lo hanno fatto loro! (a no?), ma hanno pronta la soluzione: Window XP! (perche&#8217; non Windows XP+ o ActiveWindows?) il quale (indovina un po&#8217;) eliminera&#8217; l&#8217;inferno delle DLL!</p>
<p>&#8230;io intanto continuo ad usare Linux&#8230;</p>
<p>Davide Bianchi<br />
13 Febbraio 2001</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2008/08/25/cambiando-argomento/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
