<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-3129851325103663963</atom:id><lastBuildDate>Mon, 20 Feb 2012 07:11:34 +0000</lastBuildDate><category>jse</category><category>hibernate</category><category>nio</category><category>jee</category><category>django</category><category>java</category><category>python</category><category>jpa</category><category>ejb3</category><category>spring</category><category>persistency</category><title>Eyal Lupu Java Blog</title><description>Java and JEE related techniques, HOWTOs, thoughts and more</description><link>http://blog.eyallupu.com/</link><managingEditor>noreply@blogger.com (Eyal Lupu)</managingEditor><generator>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/EyalLupuJavaBlog" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="eyallupujavablog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">EyalLupuJavaBlog</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bloglines.com/sub/http://feeds.feedburner.com/EyalLupuJavaBlog" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2FEyalLupuJavaBlog" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-3694576740681147852</guid><pubDate>Fri, 13 Jan 2012 08:19:00 +0000</pubDate><atom:updated>2012-02-18T07:41:10.764-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">django</category><category domain="http://www.blogger.com/atom/ns#">python</category><title>How to configure nginx and uWSGI to serve Django projects</title><description>This time a post about Python...lately I was dealing with a Django based project. One of the tasks in the project was to deploy the application using nginx and uWSGI. To document the process and to help others I decided to post a short explanation on how to configure nginx, uWSGI and Django to work together. Unlike most articles I found over the internet I&amp;#39;m not just laying down the final configuration but I&amp;#39;m trying to explain what happens in each step – hopefully it will be useful to others.&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2012/01/how-to-configure-nginx-and-uwsgi-to.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-3694576740681147852?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2012/01/how-to-configure-nginx-and-uwsgi-to.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-8046721087521005089</guid><pubDate>Fri, 11 Nov 2011 13:00:00 +0000</pubDate><atom:updated>2012-02-18T07:42:23.140-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">jse</category><category domain="http://www.blogger.com/atom/ns#">nio</category><title>Java 7 Working With Directories: DirectoryStream, Filter and PathMatcher</title><description>My previous post was &lt;a href="http://blog.eyallupu.com/2011/06/java-7-path-manipulation-using.html" rel="me"&gt;about Java 7&amp;#39;s new java.nio.file.Path class&lt;/a&gt; this time I want to continue and explorer some of the other new file system related APIs in Java 7.&lt;br&gt;
&lt;br&gt;
&lt;h4&gt;java.nio.file.DirectoryStream&lt;t&gt;&lt;/t&gt;&lt;/h4&gt;DirectoryStream provides an easy way to iterate over directories content, but more than that it introduces a solution for a long existing problem of listing within very large directories. If I wanted to list folder entries using previous Java versions I had to use one of the java.io.File&amp;#39;s &lt;span style="font-style: italic;"&gt;list()&lt;/span&gt; or &lt;span style="font-style: italic;"&gt;listFiles()&lt;/span&gt; overloaded methods:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;pre class="java-code"&gt;&lt;span class="java-code-comment"&gt;// Pre Java 7 Directory Listing Example&lt;/span&gt;
File f = new File(&amp;quot;c:/tmp&amp;quot;);
String[] names = f.list();

&lt;span class="java-code-comment"&gt;// At this point Java listed all files in c:/tmp and loaded their names into an array of Strings&lt;/span&gt;
for (String name : names) {
 System.out.println(name);
}&lt;/pre&gt;&lt;br&gt;
The problem with the old API is that once I asked a File object to list its entries it would immediately scan the folder creating an array of strings (or file objects if listFiles() was used) for each entry in the folder. This approach might take some time when scanning very large folders but more important than that is the memory overhead – the old API pre-fetches and pre-allocates all entries in the folder even if, for example, all I wanted to do was to print out the names of the first five files found in the folder. Java 7 introduces the new DirectoryStream interface which can be used to iterate over a directory without preloading its content into memory. First here is a basic usage example:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2011/11/java-7-working-with-directories.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-8046721087521005089?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2011/11/java-7-working-with-directories.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-860792631196757866</guid><pubDate>Wed, 22 Jun 2011 14:14:00 +0000</pubDate><atom:updated>2011-11-11T05:07:50.040-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">jse</category><category domain="http://www.blogger.com/atom/ns#">nio</category><title>Java 7 - Path Manipulation Using java.nio.file.Path</title><description>Lately I had the feeling it&amp;#39;s about time to starts looking into Java 7 EA, it has been under development for some time now and by the latest news it should be released soon. So I downloaded JDK 7-EA and Netbeans 7 (Eclipse doesn&amp;#39;t support Java 7 language changes yet) and looked for interesting changes in the release notes, the first few I&amp;#39;ve noticed are the I/O enhancements on which I decided to write a post or two starting with a short coverage of the new APIs for path manipulation in the new java.nio.file.Path interface.&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2011/06/java-7-path-manipulation-using.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-860792631196757866?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2011/06/java-7-path-manipulation-using.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-6772621074872415445</guid><pubDate>Fri, 28 Jan 2011 09:02:00 +0000</pubDate><atom:updated>2012-02-18T08:10:49.397-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">hibernate</category><category domain="http://www.blogger.com/atom/ns#">jpa</category><category domain="http://www.blogger.com/atom/ns#">jee</category><title>Hibernate/JPA Identity Generators</title><description>&lt;h4&gt;Introduction&lt;/h4&gt;As usually it has been a long time since I have last posted in my blog, and even longer (about half a year) since the last time I wrote about Hibernate but finally I have fond the tome for that. This post is about Hibernate standard compatible (TABLE, SEQUENCE, IDENTITY, and AUTO) identity generators: it explains what the identity generators are and illustrated the different considerations need to be taken when choosing identity generation strategy.&lt;br&gt;
&lt;br&gt;
&lt;h5&gt;Environment&lt;/h5&gt;&lt;ul&gt;&lt;li&gt;Hibernate - 3.5.6-Final&lt;/li&gt;
&lt;li&gt;PostgreSQL - 8.4 &lt;/li&gt;
&lt;/ul&gt;&lt;h5&gt;&lt;/h5&gt;&lt;a href="http://blog.eyallupu.com/2011/01/hibernatejpa-identity-generators.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-6772621074872415445?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2011/01/hibernatejpa-identity-generators.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-6937145521372317562</guid><pubDate>Mon, 20 Sep 2010 06:21:00 +0000</pubDate><atom:updated>2010-09-23T08:06:04.365-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Under the Hood of Java Strings Concatenating Performance</title><description>&lt;h4&gt;Introduction&lt;/h4&gt;In my previous &lt;a href="http://blog.eyallupu.com/2010/08/four-things-to-remember-about.html"&gt;post&lt;/a&gt; I covered some of the more sophisticated Java strings management issues (Collators, Normalizer, interning, substring). Few of the readers of that post left comments asking about StringBuilder vs. StringBuffer vs. the built-in concatenation (+) operator performance. To have a closure to the subject I decided to elaborate on Java strings concatenating. &lt;br&gt;
&lt;br&gt;
&lt;h5&gt;Is It Important?&lt;/h5&gt;In java we talk a lot about strings concatenating which brings up questions about the importance of that. As always the answer depends on the scenario, if we just want to take two strings and print a message composed out of these strings it is probably doesn&amp;#39;t matter - we can use the + operator or String.concat() method and get it done. It is more important when we are processing mass of data and loop a logic performing strings concatenating. &lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2010/09/under-hood-of-java-strings.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-6937145521372317562?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2010/09/under-hood-of-java-strings.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-4935790596563227843</guid><pubDate>Tue, 17 Aug 2010 11:49:00 +0000</pubDate><atom:updated>2012-02-19T23:11:34.823-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Four Things to Remember about java.lang.String</title><description>Hi,&lt;br&gt;
Usually this (and my &lt;a href="http://www.jroller.com/eyallupu"&gt;old&lt;/a&gt;) blog is more Hibernate, Spring and other JEE/Server side technologies. Still on my day to day work (and mainly when I lecture) I see a lot of misunderstanding/misconception about basic Java tasks. I decided to drop some notes about such subjects from time to time - and today four issues about java.lang.String:&lt;br&gt;
&lt;ul&gt;&lt;li&gt;Strings are immutable - a very basic one, just a reminder &lt;/li&gt;
&lt;li&gt;Strings Equality, Normalizer, and Collator - an overview of strings equality in a Locale sensitive  environments (including accented forms)&lt;/li&gt;
&lt;li&gt;The substring() method might cause memory leaks - in some scenarios the usage of String.substring() method can cause memory leaks&lt;/li&gt;
&lt;li&gt;String.intern() - how to improve strings equality performance and memory footprint using String.intern()&lt;/li&gt;
&lt;/ul&gt;&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2010/08/four-things-to-remember-about.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-4935790596563227843?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2010/08/four-things-to-remember-about.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>15</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-81892252348980409</guid><pubDate>Fri, 25 Jun 2010 09:11:00 +0000</pubDate><atom:updated>2011-11-11T05:08:27.399-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">persistency</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">hibernate</category><category domain="http://www.blogger.com/atom/ns#">ejb3</category><category domain="http://www.blogger.com/atom/ns#">jee</category><title>Hibernate 3.5/JPA 2.0 - New Query Expressions</title><description>Hi all,&lt;br&gt;
&lt;br&gt;
As usual it took me a long time to write to my blog again but finally here it is - in this post I continue writing about JPA 2.0 (my previous post is &lt;a href="http://eyal-lupu.blogspot.com/2010/04/hibernate-350-cr-2jpa-20-getting.html" target="_blank"&gt;here&lt;/a&gt;), more than that this is the first entry I&amp;#39;m publishing in my new (the old one is &lt;a href="http://www.jroller.com/eyallupu/" target="_blank"&gt;here&lt;/a&gt;) blog - Congratulations to me :-). Anyhow in this post I&amp;#39;m trying to go over some of the new functions introduced by JPA 2.0 to the JPA query language. As always my platform is Hibernate but I am using only JPA standard annotation and query syntax. The post includes the following:&lt;br&gt;
&lt;ul&gt;&lt;li&gt;The INDEX function (and the @OrderColumn annotation)&lt;/li&gt;
&lt;li&gt;The TYPE expression, and&lt;/li&gt;
&lt;li&gt;The four types of case expressions&lt;/li&gt;
&lt;/ul&gt;&lt;h4&gt;My environment&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;Hibernate 3.5.2-Final&lt;/li&gt;
&lt;li&gt;PostgreSQL 8.3&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;&lt;/div&gt;&lt;a href="http://blog.eyallupu.com/2010/06/hibernate-350-cr-2jpa-20-new-query.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-81892252348980409?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2010/06/hibernate-350-cr-2jpa-20-new-query.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-3375848390097412951</guid><pubDate>Fri, 30 Apr 2010 11:12:00 +0000</pubDate><atom:updated>2011-11-11T05:08:27.400-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">persistency</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">hibernate</category><category domain="http://www.blogger.com/atom/ns#">ejb3</category><category domain="http://www.blogger.com/atom/ns#">jee</category><title>Hibernate 3.5.0-CR-2/JPA 2.0 - Getting Started</title><description>Version 2.0 of the Java Persistency API (JPA), a.k.a &lt;a href="http://jcp.org/en/jsr/summary?id=317" target="blank"&gt;JSR-317&lt;/a&gt;, was released a while ago (10-December-2009) and Hibernate&amp;#39;s next version (3.5.0) will implement this version of the specification. In this, and the next, blog entries I&amp;#39;m planning to explorer JPA 2.0 new features and Hibernate implementation of those feature. Since this is the first post in the series I&amp;#39;ll focus on environment setup and include only few new mapping options:&lt;br&gt;
&lt;ul&gt;&lt;li&gt;The orphanRemoval option&lt;/li&gt;
&lt;li&gt;The ElementCollection annotaiotn, and&lt;/li&gt;
&lt;li&gt;The CollectionTable annotation&lt;/li&gt;
&lt;/ul&gt;On my next posts I&amp;#39;ll cover some more options.&lt;br&gt;
&lt;br&gt;
&lt;h4&gt;My Environment&lt;/h4&gt;&lt;br&gt;
&lt;ul&gt;&lt;li&gt;Hibernate 3.5.0-CR-2 (Please notice that Hibernate 3.5 is still a &lt;b&gt;candidate release&lt;/b&gt; so things written in this blog entry might change in the future)&lt;/li&gt;
&lt;li&gt;Database PostgreSQL 8.3&lt;/li&gt;
&lt;/ul&gt;&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2010/04/hibernate-350-cr-2jpa-20-getting.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-3375848390097412951?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2010/04/hibernate-350-cr-2jpa-20-getting.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-6710898111957170234</guid><pubDate>Sat, 10 Oct 2009 17:09:00 +0000</pubDate><atom:updated>2010-07-10T04:14:04.002-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">spring</category><title>Spring 3.0 - Expression Language Support</title><description>One of the new features in Spring 3.0 is the Spring Expression Language (Spring EL or SpEL). While evaluation Spring 3.0 I was also checking out the SpEL capabilities, in this blog entry I&amp;#39;ll try to cover some of the more interesting, and less obvious, features and aspects of the SpEL.&lt;br&gt;
&lt;br&gt;
&lt;h4&gt;The Basics&lt;/h4&gt;&lt;br&gt;
In its basics SpEL is yet another Expression Language, similar to Unified EL, it supports expressions (no control statements in the language) mainly used to access bean properties, the Spring Expression Language can be used as part of the Spring bean factory configuration (XML or annotation based) but can also be evaluated directly by the application code - meaning we can read and evaluate expressions at runtime. Here is the most basic example of SpEL used in&lt;br&gt;
XML factory bean:&lt;br&gt;
&lt;br&gt;
&lt;pre class="java-code"&gt;&lt;code&gt;&amp;lt;!-- Classic - Simple bean with random value --&amp;gt;
&amp;lt;bean id=&amp;quot;randomNumber&amp;quot; class=&amp;quot;java.lang.Math&amp;quot; factory-method=&amp;quot;random&amp;quot;/&amp;gt;
&amp;lt;bean id=&amp;quot;classicBean&amp;quot; class=&amp;quot;com.jroller.blogs.eyallupu.MyBean&amp;quot; p:random-ref=&amp;quot;randomNumber&amp;quot;/&amp;gt;


&amp;lt;!-- SpEL - Getting the value of the Random bean --&amp;gt;
&amp;lt;bean id=&amp;quot;elBean&amp;quot; class=&amp;quot;com.jroller.blogs.eyallupu.MyBean&amp;quot; p:random=&amp;quot;&lt;span class="java-code-strong"&gt;#{randomNumber}&lt;/span&gt;&amp;quot;/&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2009/10/spring-30-expression-language-support.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-6710898111957170234?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2009/10/spring-30-expression-language-support.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-6108587052507025105</guid><pubDate>Sat, 18 Jul 2009 06:57:00 +0000</pubDate><atom:updated>2011-11-11T05:08:27.400-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">persistency</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">hibernate</category><category domain="http://www.blogger.com/atom/ns#">ejb3</category><category domain="http://www.blogger.com/atom/ns#">jee</category><title>Hibernate Derived Properties - Performance and Portability</title><description>&lt;div style="text-align: justify;"&gt;Hi all,&lt;br&gt;
&lt;br&gt;
This time about derived properties, maybe this is not a commonly used feature, and maybe even a little bit hidden one (I don&amp;#39;t think I have ever been asked about it in any of the Hibernate courses I had lectured in and this usually a sign that people are not familiar with that feature) but once you&amp;#39;re familiar with that it is a powerful feature - however, as always, there are considerations regarding of how and when to use it.&lt;/div&gt;&lt;br&gt;
&lt;h4&gt;What Is a Derived Property?&lt;/h4&gt;&lt;br&gt;
&lt;div&gt;A derived, or calculated, property is a &lt;u&gt;read only&lt;/u&gt; property which its value is calculated at fetch time using SQL expressions. For example a Product class might have a price and a calculated&lt;br&gt;
final price which is the price including VAT. The first (not so good) solution might be something like that:&lt;/div&gt;&lt;br&gt;
&lt;pre class="java-code"&gt;&lt;code&gt;@Entity
@Table(name=&amp;quot;PRODUCTS&amp;quot;)
public class Product {

  @Column(name=&amp;quot;PRICE&amp;quot;)
  private float price;
  
  &lt;span style="color: #0080ff;"&gt;&lt;b&gt;public float getFinalPrice() { 
    return VAT*price; 
  }&lt;/b&gt;&lt;/span&gt; 
}&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;
The &lt;code&gt;getFinalPrice()&lt;/code&gt; method in the example above is kind of a calculated property - but it doesn&amp;#39;t use Hibernate support for at all - and it is &lt;u&gt;not&lt;/u&gt; a derived property, this is only a simple getter which performs a calculation. In first look it seems good enough but it will work only for the&lt;br&gt;
simple cases when we wish to perform calculation &lt;b&gt;in memory&lt;/b&gt; (for example for display purpose) but what if we would like to query (&amp;quot;I want all of the products which their &lt;i&gt;final price&lt;/i&gt; is larger than $10&amp;quot;) or sort by the calculated value? Here Hibernate comes to our help.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2009/07/hibernate-derived-properties.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-6108587052507025105?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2009/07/hibernate-derived-properties.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-5419173988611642392</guid><pubDate>Tue, 07 Jul 2009 06:17:00 +0000</pubDate><atom:updated>2011-11-11T05:08:27.401-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">spring</category><category domain="http://www.blogger.com/atom/ns#">jee</category><title>Content Negotiation using Spring MVC's ContentNegotiatingViewResolver</title><description>&lt;div style="text-align: justify;"&gt;Hi all,&lt;/div&gt;&lt;br&gt;
One of the new features in Spring 3.0 is REST support, REST clients can use the restTemplate class and server as part of the MVC framework. In chapter 18 of the 3.0.M3 documentation we can find a section describing content negotiation using the &lt;i&gt;ContentNegotiatingViewResolver&lt;/i&gt; class. Lately I was invited to give a lecture about the new Spring 3.0 features and I prepared a detailed HOWTO example (if you want to skip the theory scroll down to HOTWO) of REST content negotiation which I decided to load to my blog, here it is&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;h4&gt;What is Content Negotiation?&lt;/h4&gt;&lt;br&gt;
Sometimes different HTTP clients would like to get different representations of a the same resource, for example the resource http://localhost/app/rest/users will list all of the users in a specific server - however one client would like to get the result as a XML document, another in a JSON format and the third as a human readable fancy HTML table - the process in which a client notifying the server about the preferred format (or formats) is named &amp;quot;content negotiation&amp;quot;. &lt;br&gt;
&lt;br&gt;
Content negotiation is part of the HTTP specification which defines two types of content negotiation - &amp;quot;server-driven negotiation&amp;quot; and &amp;quot;agent-driven negotiation&amp;quot;. The scenario implemented by ContentNegotiatingViewResolver is server-driven negotiation. In abstract the specification defines server-driven negotiation as the following sequence:&lt;br&gt;
&lt;ol&gt;&lt;li&gt;The agent (e.g., a browser) can include the following HTTP headers in a request: Accept, Accept-Charset, Accept-Encoding, Accept-Language, and User-Agent.&lt;/li&gt;
&lt;li&gt;Base on these headers the sever selects the best format (based on the server&amp;#39;s internal logic) that match these criteria and send it to the client.&lt;/li&gt;
&lt;/ol&gt;&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2009/07/content-negotiation-using-spring-mvcs.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-5419173988611642392?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2009/07/content-negotiation-using-spring-mvcs.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-3724247061187101441</guid><pubDate>Wed, 30 May 2007 05:35:00 +0000</pubDate><atom:updated>2011-11-11T05:08:27.401-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">persistency</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">hibernate</category><category domain="http://www.blogger.com/atom/ns#">jee</category><title>Hibernate's hbm2ddl Tool</title><description>Hi again,&lt;br&gt;
I was asked by one of my customers about the hbm2ddl, and I since I  had some time to spare I decided to write the answer in the blog, here it is:&lt;br&gt;
Hibernate hbm2ddl is a tool allowing us to create, update, and  validate a database schema using Hibernate mappings configuration. The .hbm files  are Hibernate mapping files, but since the schema export/validation is done  using the the internal configuration Hibernate creates for the entities  mapping, we can use still use hbm2ddl when working with JPA. As usual in here I  write about the JPA environment, just remember that the hbm2ddl can also be invoked  from command line or using Ant task.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2007/05/hibernates-hbm2ddl-tool.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-3724247061187101441?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2007/05/hibernates-hbm2ddl-tool.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>11</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3129851325103663963.post-410376561370741504</guid><pubDate>Thu, 15 Jun 2006 10:58:00 +0000</pubDate><atom:updated>2011-11-11T05:08:27.402-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">persistency</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">hibernate</category><category domain="http://www.blogger.com/atom/ns#">ejb3</category><category domain="http://www.blogger.com/atom/ns#">jee</category><title>Hibernate Exception - Simultaneously Fetch Multiple Bags</title><description>One of my customers has just upgraded to JBoss 4.0.4-GA, the process also required us to upgrade Hibernate products to the following versions:&lt;br&gt;
&lt;ul&gt;&lt;li&gt;Hibernate core – 3.2.0CR2&lt;/li&gt;
&lt;li&gt;Hibernate Entity Manager – 3.2.0CR1&lt;/li&gt;
&lt;li&gt;Hibernate annotations- 3.2.0CR1&lt;/li&gt;
&lt;/ul&gt;We fixed some minor changes and improvements and then we bumped into the following exception&lt;br&gt;
&lt;br&gt;
&lt;pre class="java-code"&gt;javax.persistence.PersistenceException: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
     at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:217)
     at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
        ........

&lt;/pre&gt;The Exception is thrown by org.hibernate.loader.BasicLoader and it means that when loading an entity Hibernate might has to simultaneously fetch two or more bags.  &lt;br&gt;
&lt;br&gt;
&lt;h4&gt;So what is the problem?&lt;/h4&gt;When an entity has more than one &lt;b&gt;non-lazy &lt;/b&gt;association that might be interpreted as a &lt;b&gt;bag&lt;/b&gt; (e.g., java.util.List or java.util.Collection properties annotated with @org.hibernate.annotations.CollectionOfElements or @OneToMany or @ManyToMany and &lt;i&gt;not&lt;/i&gt; annotated with @org.hibernate.annotations.IndexColumn) hibernate will fail to fetch the entity correctly.&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.eyallupu.com/2010/06/hibernate-exception-simultaneously.html#more"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3129851325103663963-410376561370741504?l=blog.eyallupu.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.eyallupu.com/2010/06/hibernate-exception-simultaneously.html</link><author>noreply@blogger.com (Eyal Lupu)</author><thr:total>8</thr:total></item></channel></rss>

