<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6008043529821824003</id><updated>2011-08-02T07:16:45.231-07:00</updated><category term='DRM'/><category term='SecuROM'/><category term='Mirror&apos;s Edge'/><category term='Java'/><category term='Aion'/><category term='Database'/><category term='Linux'/><category term='World of Warcraft'/><title type='text'>Sauntering Coder</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-933469575219645990</id><published>2011-03-23T20:42:00.001-07:00</published><updated>2011-03-23T21:54:01.138-07:00</updated><title type='text'>Smartphone as PDA</title><content type='html'>&lt;p&gt;After posting about potential PDAs 4 months ago, and spending several more hours researching alternatives, I finally concluded that the HTC Touch Diamond really is the perfect (or as close as the market will allow) device for me. Even better that it occasionally shows up on sale for about 30% off at Newegg, so I recently picked one up.&lt;/p&gt;
&lt;p&gt;Several more hours of investigation have followed. I've seen it may be possible to upgrade the device to Windows Mobile 6.5, and even install Andorid. Not being ready for that kind of commitment, I've just been finding various programs and tweaks to turn it into my new PDA.&lt;/p&gt;
&lt;p&gt;Thus begins the migration from my Palm z22 to Windows Mobile 6.1 HTC Touch Diamond&lt;/p&gt;
&lt;h4&gt;Programs&lt;/h4&gt;
&lt;p&gt;First programs I install are .NET Compact Framework 3.5, SQLServerCompact 3.5 Core, and full featured &lt;a href="http://www.xda-developers.com/windows-mobile/japanese-display-and-input-addon-for-wm/"&gt;Japanese Display and Input&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After a reset, Dred Sensor, OpenMobileMaps, (Japanese) Pocket Dictionary (along with EDICT), JWPce (be sure to use the ARM "palm" version), Pocket Digital Clock, Total Commander Pocket.&lt;/p&gt;
&lt;h4&gt;System tweaks&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Settings -&amp;gt; Personal -&amp;gt; Menus -- Remove Phone&lt;/li&gt;
&lt;li&gt;Settings -&amp;gt; Sounds &amp;amp; Notifications -&amp;gt; Notifications&lt;ul&gt;
&lt;li&gt;All Phone and Messaging options -- Disable all sounds/notifications&lt;/li&gt;
&lt;li&gt;Event: Reminders -- Disable visible calendar popups&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Settings -&amp;gt; Today -&amp;gt; Items -- Deselect TouchFLO 3D and select Pocket Digital Clock and Calendar&lt;/li&gt;
&lt;li&gt;Settings -&amp;gt; Today -&amp;gt; Items -&amp;gt; Pocket Digital Clock Options -- Disable seconds display&lt;/li&gt;
&lt;li&gt;Settings -&amp;gt; System -&amp;gt; Error Reporting -- Disable it&lt;/li&gt;
&lt;li&gt;Settings -&amp;gt; Comm Manager -&amp;gt; Always keep Phone turned off&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I hunted a long time for a (free) program to change button behavior. Dred Sensor had all the power I needed. Using Dred Sensor, I replace all the Send and End button behavior as shortcuts to Calendar and Notepad (similar to how my Palm was setup). I also set a long-press shortcut of one of the buttons to open Comm Manager for quick toggle of WiFi setting.&lt;/p&gt;
&lt;p&gt;Copy a pic to the phone, then browse to it and select it, then set it as the background to change its translucency setting (you can't set that from Settings -&amp;gt; Today)&lt;/p&gt;
&lt;p&gt;Google Maps is a very nice program, but pretty much requires constant connectivity--something I (thankfully) don't have (to pay for). So to save maps for OpenMobileMaps, first start OpenMobileMaps so it can setup its cache folders. Then download a &lt;a href="http://metaviewsoft.de/wordpress/?p=331"&gt;&lt;strong&gt;fixed&lt;/strong&gt; version of JTileDownloader&lt;/a&gt;, browse an area of interest on the OpenMaps site, download the tiles, and copy them into the cache folders on the Diamond. &lt;/p&gt;
&lt;p&gt;I haven't yet needed to tweak the registry, but MobileRegistryEditor is my editor of choice.&lt;/p&gt;
&lt;h4&gt;Transferring Data&lt;/h4&gt;
&lt;p&gt;I've used HandyShopper on the Palm for years -- it's a brilliant program. Thankfully it's also available for Windows Mobile. Transferring the shopping list is a breeze. Just find the backed up database in &lt;code&gt;%USERPROFILE%\Documents\Palm OS Desktop\&amp;lt;id&amp;gt;\Backup\HS2_Shopping.PDB&lt;/code&gt; and simply copy it to the device. Browse to the PDB file on the device and just click on it. Your list is now available on the Diamond.&lt;/p&gt;
&lt;p&gt;The biggest issue I had was getting the Palm Note Pad scribbles off the z22. Since Palm all but dropped support for the Palm OS and Windows 7, I had to download their latest (and final) version of the desktop client off their website. Unfortunately that version of Palm Desktop doesn't provide an interface for Note Pad. Forum posts suggested I had to find a computer with WinXP and install the older software that came with the z22 to sync those Note Pad images off the device.&lt;/p&gt;
&lt;p&gt;While I still have XP on my lappy, it sure seemed like a hassle -- and what about people who don't have XP anymore? So I turned to Open Source for help. After installing all variations of Palm related software in Ubuntu, nothing seemed to provide a GUI for getting those Note Pad images. Then I happened upon a man page for a command-line tool called &lt;a href="http://manpages.ubuntu.com/manpages/intrepid/man1/pilot-read-notepad.1.html"&gt;pilot-read-notepad&lt;/a&gt;. To my surprise, the following command actually worked&lt;/p&gt;
&lt;div class="codehilite" style="background: #f8f8f8; border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden"&gt;&lt;pre style="line-height: 125%"&gt;pilot-read-notepad --type&lt;span style="color: #ce5c00; font-weight: bold"&gt;=&lt;/span&gt;png -p usb: &amp;gt; list.txt
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;After pressing sync on the device, I found myself with all the images exported (some of the note titles with illegal characters had to be tweaked).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-933469575219645990?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/933469575219645990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2011/03/smartphone-as-pda.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/933469575219645990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/933469575219645990'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2011/03/smartphone-as-pda.html' title='Smartphone as PDA'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-7933135933796175072</id><published>2011-03-23T19:46:00.001-07:00</published><updated>2011-03-24T06:25:32.731-07:00</updated><title type='text'>Blogging with Markdown</title><content type='html'>&lt;p&gt;I haven't done much blogging lately, so most of the asciidoc esoteric syntax is gone from me. Meanwhile, I've been using Markdown on a couple of popular web sites. Markdown has come a long way since I &lt;a href="http://erictheturtle.blogspot.com/2009/04/highlighting-code-snippets.html"&gt;first investigated a blogging markup language with code highlighting&lt;/a&gt;. There is now a &lt;a href="http://www.freewisdom.org/projects/python-markdown/"&gt;Python module&lt;/a&gt; with the built-in &lt;a href="http://www.freewisdom.org/projects/python-markdown/CodeHilite"&gt;CodeHilite&lt;/a&gt; extension. &lt;a href="http://mybyteofcode.blogspot.com/2010/01/use-markdown-and-pygments-with-blogger.html"&gt;This post&lt;/a&gt; gave me the confidence that Markdown was ready for primetime.&lt;/p&gt;
&lt;p&gt;Here's how I setup my new blogging solution with Markdown*:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install Python 2.5+&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://pypi.python.org/pypi/Markdown/2.0.3"&gt;Markdown source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://pypi.python.org/pypi/Pygments"&gt;Pygments source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Uncompress the Markdown directory&lt;/li&gt;
&lt;li&gt;Uncompress the Pygments directory&lt;/li&gt;
&lt;li&gt;From the Pygments directory, move the &lt;code&gt;pygments&lt;/code&gt; and &lt;code&gt;external&lt;/code&gt; sub-directories into the Markdown directory&lt;/li&gt;
&lt;li&gt;Apply &lt;a href="http://gitorious.org/python-markdown/mainline/merge_requests/3"&gt;this patch&lt;/a&gt; to the Markdown source files so &lt;code&gt;noclasses&lt;/code&gt; configuration is exposted and &lt;code&gt;fenced_code&lt;/code&gt; is also highlighted (I'm bummed this patch isn't included in the downloaded source)&lt;/li&gt;
&lt;li&gt;Download and install the &lt;a href="http://hasseg.org/blog/post/302/markdown-and-pod-syntax-highlighting-modes-for-jedit/"&gt;jEdit syntax&lt;/a&gt; and &lt;a href="http://github.com/thomsmits/markdown_npp"&gt;Notepad++&lt;/a&gt; syntax files&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now the following command will do the work**:&lt;/p&gt;
&lt;div class="codehilite" style="background: #f8f8f8; border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000000"&gt;python&lt;/span&gt; &lt;span style="color: #000000"&gt;markdown&lt;/span&gt;&lt;span style="color: #ce5c00; font-weight: bold"&gt;.&lt;/span&gt;&lt;span style="color: #000000"&gt;py&lt;/span&gt; &lt;span style="color: #000000"&gt;input&lt;/span&gt;&lt;span style="color: #ce5c00; font-weight: bold"&gt;.&lt;/span&gt;&lt;span style="color: #000000"&gt;md&lt;/span&gt; &lt;span style="color: #ce5c00; font-weight: bold"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;o&lt;/span&gt; &lt;span style="color: #000000"&gt;html4&lt;/span&gt; &lt;span style="color: #ce5c00; font-weight: bold"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;x&lt;/span&gt; &lt;span style="color: #4e9a06"&gt;&amp;quot;codehilite(noclasses=True)&amp;quot;&lt;/span&gt; &lt;span style="color: #ce5c00; font-weight: bold"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;x&lt;/span&gt; &lt;span style="color: #000000"&gt;fenced_code&lt;/span&gt; &lt;span style="color: #ce5c00; font-weight: bold"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;f&lt;/span&gt; &lt;span style="color: #000000"&gt;output&lt;/span&gt;&lt;span style="color: #ce5c00; font-weight: bold"&gt;.&lt;/span&gt;&lt;span style="color: #000000"&gt;html&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I still have to manually create the blog post in Blogger, but then it's just a copy-paste of the html, and I'm done.&lt;/p&gt;
&lt;p&gt;&lt;sub&gt;* I don't like installing Python modules because I rarely use them--hence the simple uncompressing and use in-place.&lt;/sub&gt;&lt;/p&gt;
&lt;p&gt;&lt;sub&gt;** Like with my previous blogging solution, I like the syntax CSS to be inline.&lt;/sub&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-7933135933796175072?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/7933135933796175072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2011/03/blogging-with-markdown.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/7933135933796175072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/7933135933796175072'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2011/03/blogging-with-markdown.html' title='Blogging with Markdown'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-9172940173175501900</id><published>2010-11-04T21:16:00.000-07:00</published><updated>2011-03-24T06:34:18.380-07:00</updated><title type='text'>Using the iPod Touch as a PDA</title><content type='html'>I've been sporting the stylish &lt;a href="http://reviews.cnet.com/pdas/palm-z22/4505-3127_7-31546758.html"&gt;Palm z22&lt;/a&gt; for several years now (originally purchased for $100), and its battery is beginning to fail. Would it be too much to ask for something similar at a similar price point? Apparently it is. There is only one company that still makes normal PDAs: HP with their &lt;a href="http://www.shopping.hp.com/webapp/shopping/product_detail.do?storeName=storefronts&amp;landing=handheld&amp;category=PDA&amp;lanAttr=Type&amp;product_code=FA979AA%23ABA&amp;catLevel=2"&gt;iPaq 111&lt;/a&gt; (3 times the cost!) and 211. So if I can't get a PDA, it seems Portable Media Devices (PMD) are the only alternative.&lt;br&gt;
&lt;br&gt;
The iPod Touch almost meets the bill, but still lacks a way to properly scribble notes. Researching compatible styluses led to the &lt;a href="http://www.amazon.com/BoxWave-Capacitive-iPad-Stylus-Black/dp/B000BUI76S"&gt;BoxWave Mini stylus&lt;/a&gt;, which is adequate, but falls short of my 5 year old PDA's accuracy. I could settle with that, if only there was a decent case that would hold it for me. Again, I must be asking way too much because there are currently only two* (2) on the market, and they are &lt;a href="http://www.zimbio.com/iPhone+3G/articles/culisdNTsYj/Check+Out+GTMax+Leather+Case+Stylus+Pen+Holder"&gt;ugly&lt;/a&gt; as &lt;a href="http://www.amazon.com/Premium-Silver-Leather-Protector-Generation/dp/B002BXCDCW/ref=cm_cr_pr_product_top"&gt;sin&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
Fine, I won't get the iPod Touch. So what's left? The Creative Zen seemed to be able to sync with MS Outlook...&lt;a href="http://en.wikipedia.org/wiki/Creative_ZEN#ZEN_Vision_W"&gt;about 4 years ago&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
If I can't get a PDA, or a PMD, I guess I could just get a stinkin' smartphone and just never activate it. Lo and behold that's not such a bad idea. The &lt;a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16875502060"&gt;HTC Tilt&lt;/a&gt; and &lt;a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16875502009"&gt;HTC Touch Diamond&lt;/a&gt; are both available unlocked on Newegg for not terrible prices. Plus they even have a camera that's 3x better than my cellphone's. Just wish I could try out those devices before committing $half-a-PS3 to it.&lt;br&gt;
&lt;br&gt;
&lt;sub&gt;* Got my links messed up. There is &lt;a href="http://www.amazon.com/iPhone-Dockable-Protective-built-stylus/dp/B00313K120/ref=pd_sim_cps_36"&gt;one case&lt;/a&gt; that I really like, but it's only compatible with iPhone.&lt;/sub&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-9172940173175501900?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/9172940173175501900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2010/11/using-ipod-touch-as-pda.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/9172940173175501900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/9172940173175501900'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2010/11/using-ipod-touch-as-pda.html' title='Using the iPod Touch as a PDA'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-8813037077065263295</id><published>2010-01-27T21:40:00.001-08:00</published><updated>2010-01-27T21:40:30.951-08:00</updated><title type='text'>Parentheses</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;The fellows over at the &lt;a href="http://newlispfanclub.alh.net/forum/"&gt;newLISP fan club forums&lt;/a&gt; are a witty bunch. During yet another discussion in the long history of "how might all those parentheses be removed from Lisp" discussions, &lt;a href="http://newlispfanclub.alh.net/forum/viewtopic.php?p=16469#p16469"&gt;Elica&lt;/a&gt; solved this age old conundrum ever so gracefully.&lt;/p&gt;&lt;/div&gt; &lt;blockquote&gt; &lt;div class="paragraph"&gt;&lt;p&gt;There is one easy recursive solution, but I&amp;#8217;m afraid you will not like it, although you may enjoy it. Here it goes:&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;&lt;em&gt;To solve the problem with parentheses, we can replace them by square brackets. However, this will introduce a new problem - a problem with the square brackets. To solve it, we can replace brackets with parentheses, which will reraise the initial problem. Fortunately, we already know how to solve it.&lt;/em&gt;&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;So, everything is OK - the initial problem is reduced to a sequence of problems, each of which can be solved trivially.&lt;/p&gt;&lt;/div&gt; &lt;p align="right"&gt; &lt;/p&gt; &lt;/blockquote&gt; &lt;/div&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-8813037077065263295?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/8813037077065263295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2010/01/parentheses.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8813037077065263295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8813037077065263295'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2010/01/parentheses.html' title='Parentheses'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-4915881232476086233</id><published>2010-01-27T20:04:00.001-08:00</published><updated>2010-01-27T22:16:37.083-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java and VNC on Windows</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Sometime between JRE 1.6.0 update 3 and 1.6.0 update 15, something changed.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I use a VNC program heavily, and was surprised to see all Java Swing GUIs become almost useless because they would never refresh through VNC. Yet at the same time Netbeans still worked fine over VNC.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I sought high and low, but what kind of search string would you use for this issue?&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;As a work around at the time, I set the &lt;tt&gt;JAVA_HOME&lt;/tt&gt; to an older JRE, and updated some of my Java program shortcuts to use "C:\Program Files\Java\jre1.6.0_3\bin\javaw.exe"&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Today I finally &lt;a href="http://stackoverflow.com/questions/848481/problem-with-painting-in-java-swing-app-in-java-1-6"&gt;found the issue&lt;/a&gt; and &lt;a href="http://java.sun.com/javase/6/webnotes/trouble/TSG-Desktop/html/java2d-props.html#gdhsp"&gt;fix&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt; &lt;div class="listingblock"&gt; &lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt; &lt;pre&gt;&lt;tt&gt;&lt;span style="color: #009900"&gt;J2D_D3D&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;false&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;This problem might occur with any other kind of Remote Desktop program, or perhaps it is just those that use a special video driver.&lt;/p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Oh and Netbeans seems to run under the latest JDK installed instead of the latest JRE. Guess I should update that sometime.&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-4915881232476086233?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/4915881232476086233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2010/01/java-and-vnc-on-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/4915881232476086233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/4915881232476086233'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2010/01/java-and-vnc-on-windows.html' title='Java and VNC on Windows'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-5230641777442704033</id><published>2009-09-08T22:37:00.001-07:00</published><updated>2009-09-08T22:41:55.027-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Aion'/><title type='text'>Aion Beta: Closed vs. Open</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="dlist"&gt;&lt;dl&gt; &lt;dt class="hdlist1"&gt; &lt;strong&gt;Q.&lt;/strong&gt; What is the difference between all the previous &lt;a href="http://na.aiononline.com/"&gt;Aion&lt;/a&gt; closed betas and the current Aion &lt;a href="http://na.aiononline.com/en/news/letter-from-aion-producer-brian-knox-on-open-beta-1.html"&gt;open beta&lt;/a&gt;? &lt;/dt&gt; &lt;dd&gt; &lt;p&gt;    &lt;strong&gt;A.&lt;/strong&gt; The &amp;#8220;&lt;a href="http://www.facebook.com/pages/Aion/94261718827"&gt;open&lt;/a&gt;&amp;#8221; beta &lt;em&gt;also&lt;/em&gt; includes some lucky FilePlanet paid subscribers that got a &lt;a href="http://www.fileplanet.com/promotions/aion/beta/"&gt;limited &amp;#8220;open&amp;#8221; beta key&lt;/a&gt;. &lt;/p&gt; &lt;/dd&gt; &lt;/dl&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-5230641777442704033?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/5230641777442704033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/09/aion-beta-closed-vs-open.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/5230641777442704033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/5230641777442704033'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/09/aion-beta-closed-vs-open.html' title='Aion Beta: Closed vs. Open'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-8382122576033152687</id><published>2009-08-05T20:31:00.000-07:00</published><updated>2009-09-02T21:09:09.365-07:00</updated><title type='text'>Mozilla Store H4x3d</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Over a year ago I ordered the &lt;a href="http://blog.mozilla.com/store/2007/07/24/spread-firefox-t-shirt/"&gt;satanic Firefox t-shirt&lt;/a&gt; from the Mozilla store. I really enjoy using Firefox on a daily basis, and can certainly stand behind it via t-shrit. Unfortunately the Mozilla Store experience failed to be on par with its advertised web browser experience.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Once I got the shirt in the e-kart, I had to create a new registration. Sure, registering for &lt;em&gt;yet another&lt;/em&gt; web site is a pain (almost 50 different sites now have my credit card into, and each has their own username/password), but such is the internet today. However, after signing up, I was not re-directed to the checkout page. I assumed I needed to select the item again, so I annoyingly went back through the product listing and re-added it. This finally led me back to my shopping-cart, where I then found it contained 2 of the same item.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Removing the duplicate, I continued on and made my purchase. I then wanted to be secure by logging out, but after several minutes of searching, I was unable to find any link in which to log out. Went ahead and closed the browser, and assumed that was the last I needed to worry.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Later that day I receive an email.&lt;/p&gt;&lt;/div&gt; &lt;blockquote&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Before we can release the order to ship, we need to verify the billing and shipping information. We have ran the credit card and show that parts of the billing information supplied to this order does not match the billing information for this credit card.&lt;/p&gt;&lt;/div&gt; &lt;p align="right"&gt; &lt;/p&gt; &lt;/blockquote&gt; &lt;div class="paragraph"&gt;&lt;p&gt;???&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I&amp;#8217;ve made several dozen online orders in my day, and I&amp;#8217;ve never had a problem with my credit card. I checked the order confirmation email, and logged back onto the site. Both places had perfectly correct addresses.&lt;/p&gt;&lt;/div&gt; &lt;div class="sidebarblock"&gt; &lt;div class="sidebar-content"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Address line 1: 123 Main St. #555&lt;br /&gt; Address line 2: &amp;lt;blank&amp;gt;&lt;/p&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Even though this has never been a problem, I went ahead and added my middle initial to my name and put my apartment number on the address 2nd line. After confirming my updated info, I was dismayed to find my address displayed like this:&lt;/p&gt;&lt;/div&gt; &lt;div class="sidebarblock"&gt; &lt;div class="sidebar-content"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Address line 1: 123 Main St.&lt;br /&gt; Address line 2: #555123 Main St.&lt;/p&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;!!!&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I&amp;#8217;m not particularly paranoid about security, but after all this, I hardly felt confident sending all my address information over unencrypted email. I replied that I double-checked my address info, and everything was correct. If they wanted me to re-send it anyway, I would appreciate additional details on why.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;The patient fellow explained in his reply, "if you are a new customer ordering then, for your safety and ours the order gets held for verification purpose." Well that&amp;#8217;s nice, but it still didn&amp;#8217;t make much sense. He included my address in his email, which I added a few details that I didn&amp;#8217;t think were necessary (middle initial and name of company at the shipping address). I eventually got my shirt, and have worn it ever since.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;After all this, I can&amp;#8217;t say I&amp;#8217;m very surprised with the news that the &lt;a href="http://blog.mozilla.com/blog/2009/08/04/mozilla-store-vendor-security-breach/"&gt;Mozilla store was hacked&lt;/a&gt;. If my ordering experience is any indication of how the store&amp;#8217;s backend was handled, then they were just begging for problems.&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-8382122576033152687?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/8382122576033152687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/08/mozilla-store-hacked.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8382122576033152687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8382122576033152687'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/08/mozilla-store-hacked.html' title='Mozilla Store H4x3d'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-4709949919615322573</id><published>2009-07-27T05:21:00.001-07:00</published><updated>2009-10-06T07:44:09.340-07:00</updated><title type='text'>A Tale of Two TVs...+2</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I&amp;#8217;ve owned a cheap, 20", super ultra generic Best Buy TV for the last 5 years. It has been wonderfully reliable and well used. I think my desire for something bigger first started when I played Gears of War at a friend&amp;#8217;s house on a large screen. The display and experience was truly awesome. Since then I&amp;#8217;ve also felt my little screen didn&amp;#8217;t do justice to The Legend of Zelda: Twilight Princess. Old news to anyone in the know, but I was crushed to learn the Wii doesn&amp;#8217;t output anything HD. It does do wide screen at lest, so a new TV wouldn&amp;#8217;t be completely wasted on it (and good luck finding a 480p wide screen).&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;It wasn&amp;#8217;t until I had researched 2 months, purchased 4 TVs, then returned 3 of them, that all my requirements had been flushed out.&lt;/p&gt;&lt;/div&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_vrkdqnCR4Dk/SstWUtdGmUI/AAAAAAAAAKA/27OccO_-V2Y/s1600-h/20090726-TwilightPrincessCalibration.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 200px; height: 148px;" src="http://2.bp.blogspot.com/_vrkdqnCR4Dk/SstWUtdGmUI/AAAAAAAAAKA/27OccO_-V2Y/s200/20090726-TwilightPrincessCalibration.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5389496292877965634" /&gt;&lt;/a&gt; &lt;div class="ulist"&gt;&lt;ul&gt; &lt;li&gt; 32" wide-screen LCD &lt;/li&gt; &lt;li&gt; Closed Captioning on mute &lt;/li&gt; &lt;li&gt; The closed captioning starts appearing shortly after pressing mute &lt;/li&gt; &lt;li&gt; Passes The Legend of Zelda: Twilight Princess display calibration screen &lt;/li&gt; &lt;li&gt; Minimal input-to-display lag &lt;/li&gt; &lt;li&gt; Easily returnable &lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;The 4th TV finally met my needs (almost). Given how hard it is to find any worthwhile information on TVs (and all electronics in general) on the internet, thought I&amp;#8217;d share some details.&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;h4 id="_consumer_reports"&gt;Consumer Reports&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I&amp;#8217;ve been an off-and-on registered member of &lt;a href="http://www.consumerreports.org"&gt;Consumer Reports&lt;/a&gt;. Unlike fickle forums, their information is objective and substantiated. Unfortunately their TVs coverage is pretty lacking (but given the number of TVs on the market, it&amp;#8217;s unlikely they could really keep up). If your TV of interest isn&amp;#8217;t reviewed on the site, then the only valuable information they offer is a general brand reliability rating. Their surveys give a glimpse of what percentage of TVs are defective for a particular brand. The numbers seem to support the idea that brands do maintain a consistent level of reliability.&lt;/p&gt;&lt;/div&gt; &lt;h4 id="_a_href_http_www_walmart_com_catalog_product_do_product_id_10993794_vizio_32_vo320e_a_8201_8212_8201_400_normally_450"&gt;&lt;a href="http://www.walmart.com/catalog/product.do?product_id=10993794"&gt;Vizio 32" VO320E&lt;/a&gt;&amp;#8201;&amp;#8212;&amp;#8201;$400 (normally $450)&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;As a newcomer to the big screen TV market, I was surprised that the otherwise unheard of Vizio brand is a major player. Consumer Reports rate their reliability as one of the best. I hear they also have a pretty hefty market share. This TV on sale at Walmart has an excellent cost-to-quality ratio.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Since it was my first TV, it wasn&amp;#8217;t until after I purchased it that I realized I really like how my old CRT could show Closed Captioning when muted. This isn&amp;#8217;t a feature most people even realize exists, and it is never mentioned on retail sites. &lt;strong&gt;You have to go to the manufacturer&amp;#8217;s site, download the product&amp;#8217;s manual and read all the details. In any case, I strongly recommend people do that for any TV they plan to buy.&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;The only other down side of this TV is the simplistic remote. There are no shortcuts to menu options on the remote. For example, if you want to change the &amp;#8220;zoom&amp;#8221; display of a channel, it takes 5-6 button presses to traverse the menu system and change the settings.&lt;/p&gt;&lt;/div&gt; &lt;h4 id="_a_href_http_www_bestbuy_com_site_olspage_jsp_skuid_9154719_amp_type_product_amp_id_1218038552425_insignia_best_buy_generic_32_ns_l32q_10a_a_8201_8212_8201_400"&gt;&lt;a href="http://www.bestbuy.com/site/olspage.jsp?skuId=9154719&amp;amp;type=product&amp;amp;id=1218038552425"&gt;Insignia (Best Buy generic) 32" NS-L32Q-10A&lt;/a&gt;&amp;#8201;&amp;#8212;&amp;#8201;$400&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;After additional research, I narrowed it down to this Insignia and the RCA below. When I learned from an employee that Insignia (a generic Best Buy brand) is at least partially made by LG, I went for this one. Consumer Reports says LG reliability isn&amp;#8217;t one of the best, but at least it&amp;#8217;s on the list (unlike RCA).&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;The picture quality of this TV looks quite nice, especially when compared next to the RCA, and it has my coveted Closed Captioning on mute.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Sadly it was lacking in several other ways. The signal to some of my cable channels is a bit weak, so the picture is a little fuzzy on my CRT. On the Insignia, this weak signal sometimes exhibits itself as &lt;strong&gt;no audio&lt;/strong&gt;. I found the sound could be acquired by turning the TV off, then back on. Unfortunately the sound goes away again if you change to another channel and return. This didn&amp;#8217;t always happen, but it was enough to be very troubling. In general, this TV doesn&amp;#8217;t handle corrupted video signal very well.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Overall the TV is just very slow. It takes about 10 to 15 seconds to turn on, and channel changing often takes like 3 to 4 seconds.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;While all this is pretty lame, it was still usable&amp;#8212;that is until I tried to play video games on it. It has a seriously bad lag from receiving input to displaying the image.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I don&amp;#8217;t think there&amp;#8217;s any official name for this &amp;#8220;lag&amp;#8221; value, and it&amp;#8217;s never reported by TV manufacturers. Not all hope is lost though. There does seem to be some brand consistency. Looking around Best Buy, I noticed most, if not all the playable video game demos were setup on Samsung LCDs. I suspect Sonys are generally pretty good with lag as well. You can also find a sort of &amp;#8220;game mode&amp;#8221; feature on various TVs that skips all the image processing and just blasts the video to the screen as quickly as possible.&lt;/p&gt;&lt;/div&gt; &lt;h4 id="_a_href_http_www_bestbuy_com_site_olspage_jsp_skuid_9287354_amp_type_product_amp_id_1218090916162_rca_32_l32hd41_a_8201_8212_8201_350_normally_400"&gt;&lt;a href="http://www.bestbuy.com/site/olspage.jsp?skuId=9287354&amp;amp;type=product&amp;amp;id=1218090916162"&gt;RCA 32" L32HD41&lt;/a&gt;&amp;#8201;&amp;#8212;&amp;#8201;$350 (normally $400)&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;According to the specs, this TV has a higher contrast ratio than the Insignia, but it sure didn&amp;#8217;t look like that when sitting side-by-side. The picture was very dark and bland, and never could get bright enough, or with enough contrast to pass the Zelda Twilight Princess calibration screen.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Everything else about the TV is fine. Its input-to-display lag was pretty good, and it&amp;#8217;s the quickest to display CC after the mute button was pressed.&lt;/p&gt;&lt;/div&gt; &lt;h4 id="_a_href_http_www_bestbuy_com_site_olspage_jsp_skuid_9222646_amp_type_product_amp_id_1218062424206_sony_bravia_32_kdl_32l5000_a_8201_8212_8201_500_normally_550"&gt;&lt;a href="http://www.bestbuy.com/site/olspage.jsp?skuId=9222646&amp;amp;type=product&amp;amp;id=1218062424206"&gt;Sony - BRAVIA 32" KDL-32L5000&lt;/a&gt;&amp;#8201;&amp;#8212;&amp;#8201;$500 (normally $550)&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;After three &amp;lt;= $400 TVs, it was pretty clear I can&amp;#8217;t be cheap if I want a TV to really meet my needs. It was either this Sony or a Toshiba of the same price. I found a mention of Playstation 3 in this TV&amp;#8217;s manual (on the Sony site). I hoped this meant its lag was small enough for video games. Sure enough, its input-to-display lag is very usable.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;The picture passes Zelda Twilight Princess screen calibration without problems. All-in-all it&amp;#8217;s quite a nice TV. The only thing about it that bugs me is the 30 seconds it takes for Closed Captioning to start showing after mute is pressed. That delay is also reset if you press pretty much any button on the remote. Makes me wish there was more interest in TV firmware hacking out there.&lt;/p&gt;&lt;/div&gt; &lt;h4 id="_final_notes"&gt;Final notes&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I have yet to find a Samsung that does CC on mute.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I&amp;#8217;ve now dropped about $100 in new cables (all ordered online to avoid highway robbery) to make my home theater system complete. So this whole purchase has set met back over $600. I will also be paying higher energy costs for this new TV vs. my old CRT. That little guy will be missed.&lt;/p&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-4709949919615322573?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/4709949919615322573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/07/tale-of-two-tvs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/4709949919615322573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/4709949919615322573'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/07/tale-of-two-tvs.html' title='A Tale of Two TVs...+2'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_vrkdqnCR4Dk/SstWUtdGmUI/AAAAAAAAAKA/27OccO_-V2Y/s72-c/20090726-TwilightPrincessCalibration.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-837545844093674335</id><published>2009-06-26T19:17:00.000-07:00</published><updated>2009-08-03T13:00:52.816-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><title type='text'>Compounding Hibernate Problems 2: The Enterprise Solution Strikes Back</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;blockquote&gt; &lt;div class="paragraph"&gt;&lt;p&gt;It is a dark time for the&lt;br /&gt; developers. Although Hibernate&lt;br /&gt; can handle simple schema designs,&lt;br /&gt; existing databases have driven the&lt;br /&gt; coders from their lighthearted&lt;br /&gt; news aggregation sites to&lt;br /&gt; pursue answers from across&lt;br /&gt; the internet.&lt;/p&gt;&lt;/div&gt; &lt;p align="right"&gt; &lt;/p&gt; &lt;/blockquote&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Again I&amp;#8217;m trying to add some table relations with Hibernate&amp;#8217;s Enterprise handling of composite primary keys getting in the way.&lt;/p&gt;&lt;/div&gt; &lt;div class="sidebarblock"&gt; &lt;div class="sidebar-content"&gt; &lt;div class="dlist"&gt;&lt;dl&gt; &lt;dt class="hdlist1"&gt; &lt;em&gt;Disclaimer&lt;/em&gt; &lt;/dt&gt; &lt;dd&gt; &lt;p&gt;     This is a somewhat contrived example, but it accurately reflects the problems with a very real database. &lt;/p&gt; &lt;/dd&gt; &lt;/dl&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Back with good ol' Derby.&lt;/p&gt;&lt;/div&gt; &lt;div class="listingblock"&gt; &lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt; &lt;pre&gt;&lt;tt&gt;jdbc:derby://localhost:1527/MyDB;create=true

username=myschema
password=whatever&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;ddl&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;create&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;table&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="color: #990000"&gt;(&lt;/span&gt;
    make_id integer&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    model_id integer&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    name &lt;span style="color: #009900"&gt;varchar&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;50&lt;/span&gt;&lt;span style="color: #990000"&gt;),&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;PRIMARY&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;KEY&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;make_id&lt;span style="color: #990000"&gt;,&lt;/span&gt; model_id&lt;span style="color: #990000"&gt;)&lt;/span&gt;
&lt;span style="color: #990000"&gt;);&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;create&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;table&lt;/span&gt;&lt;/span&gt; maker_country &lt;span style="color: #990000"&gt;(&lt;/span&gt;
    make_id integer&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    country_id integer&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    make_country &lt;span style="color: #009900"&gt;varchar&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;50&lt;/span&gt;&lt;span style="color: #990000"&gt;),&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;PRIMARY&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;KEY&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;make_id&lt;span style="color: #990000"&gt;,&lt;/span&gt; country_id&lt;span style="color: #990000"&gt;)&lt;/span&gt;
&lt;span style="color: #990000"&gt;);&lt;/span&gt;


&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Chevrolet Corvette'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Chevrolet Malibu'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;2&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Ford Focus'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;2&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Ford Mustang'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Honda Accord'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Honda Odyssey'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;4&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Toyota Avalon'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;4&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Toyota Camry'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicle &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;5&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Volkswagen Bug'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; maker_country &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Chevrolet makes cars for USA'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; maker_country &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;2&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Ford makes cars for USA'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; maker_country &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;2&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Honda makes cars for Japan'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; maker_country &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Honda makes cars for USA'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; maker_country &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;4&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;2&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Toyota makes cars for Japan'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; maker_country &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;4&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Toyota makes cars for USA'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; maker_country &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;5&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Volkswagen makes cars for Germany'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; maker_country &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;5&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Volkswagen makes cars for USA'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;.cfg.xml&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt; &lt;span style="color: #009900"&gt;encoding&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"UTF-8"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-configuration&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt;
        &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Configuration DTD 3.0//EN"&lt;/span&gt;
        &lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-configuration&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;session-factory&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.connection.driver_class"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.apache.derby.jdbc.EmbeddedDriver&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.dialect"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.hibernate.dialect.DerbyDialect&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.connection.url"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;jdbc:derby://localhost:1527/MyDB;create=true&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.connection.username"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;myschema&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.connection.password"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;whatever&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.default_schema"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;MYSCHEMA&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.current_session_context_class"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;thread&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.show_sql"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;true&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/session-factory&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-configuration&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Of course we know this won&amp;#8217;t work&amp;#8230;&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt; &lt;span style="color: #009900"&gt;encoding&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"UTF-8"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-reverse-engineering&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-reverse-engineering&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table-filter&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;match-name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKER_COUNTRY"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table-filter&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;match-name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLE"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;

    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLE"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;foreign-key&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;foreign-table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKER_COUNTRY"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column-ref&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;local-column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="color: #009900"&gt;foreign-column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/foreign-key&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-reverse-engineering&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;Foreign key (FK3F2F1B0C64FEF3DE:VEHICLE [MAKE_ID])) must have same number of columns as the referenced primary key (MAKER_COUNTRY [MAKE_ID,COUNTRY_ID])&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;So we stick with the default generated reverse engineering.
We can use it to generate only the mapping files (no &lt;tt&gt;.java&lt;/tt&gt; classes yet).&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt; &lt;span style="color: #009900"&gt;encoding&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"UTF-8"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-reverse-engineering&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-reverse-engineering&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table-filter&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;match-name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKER_COUNTRY"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table-filter&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;match-name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLE"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-reverse-engineering&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Then we can edit the mapping file to add a relationship between two tables.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-mapping&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Mapping DTD 3.0//EN"&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Vehicle"&lt;/span&gt; &lt;span style="color: #009900"&gt;table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLE"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;composite-id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"id"&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VehicleId"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key-property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"makeId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"int"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/key-property&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key-property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"modelId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"int"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MODEL_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/key-property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/composite-id&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"name"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"string"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"NAME"&lt;/span&gt; &lt;span style="color: #009900"&gt;length&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"50"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;

        &lt;span style="font-style: italic"&gt;&lt;span style="color: #9A1900"&gt;&amp;lt;!-- Added this: --&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;set&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"makerCountries"&lt;/span&gt; &lt;span style="color: #009900"&gt;inverse&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt; &lt;span style="color: #009900"&gt;lazy&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"true"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;property-ref&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"makeId"&lt;/span&gt; &lt;span style="color: #009900"&gt;column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;one-to-many&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MakerCountry"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/set&amp;gt;&lt;/span&gt;&lt;/span&gt;

    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/class&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;No problem, right?&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;org.hibernate.MappingException: property-ref [makeId] not found on entity [Vehicle]&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Ok, so it can&amp;#8217;t see its own property. What if reference its key&amp;#8217;s property.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;        ...
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;property-ref&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"id.makeId"&lt;/span&gt; &lt;span style="color: #009900"&gt;column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        ...&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;It generated some classes. Let&amp;#8217;s give it a run.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;Test.java&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;import&lt;/span&gt;&lt;/span&gt; java&lt;span style="color: #990000"&gt;.&lt;/span&gt;net&lt;span style="color: #990000"&gt;.&lt;/span&gt;URL&lt;span style="color: #990000"&gt;;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;import&lt;/span&gt;&lt;/span&gt; java&lt;span style="color: #990000"&gt;.&lt;/span&gt;util&lt;span style="color: #990000"&gt;.&lt;/span&gt;List&lt;span style="color: #990000"&gt;;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;import&lt;/span&gt;&lt;/span&gt; java&lt;span style="color: #990000"&gt;.&lt;/span&gt;util&lt;span style="color: #990000"&gt;.&lt;/span&gt;Set&lt;span style="color: #990000"&gt;;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;import&lt;/span&gt;&lt;/span&gt; org&lt;span style="color: #990000"&gt;.&lt;/span&gt;hibernate&lt;span style="color: #990000"&gt;.&lt;/span&gt;Query&lt;span style="color: #990000"&gt;;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;import&lt;/span&gt;&lt;/span&gt; org&lt;span style="color: #990000"&gt;.&lt;/span&gt;hibernate&lt;span style="color: #990000"&gt;.&lt;/span&gt;Session&lt;span style="color: #990000"&gt;;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;import&lt;/span&gt;&lt;/span&gt; org&lt;span style="color: #990000"&gt;.&lt;/span&gt;hibernate&lt;span style="color: #990000"&gt;.&lt;/span&gt;SessionFactory&lt;span style="color: #990000"&gt;;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;import&lt;/span&gt;&lt;/span&gt; org&lt;span style="color: #990000"&gt;.&lt;/span&gt;hibernate&lt;span style="color: #990000"&gt;.&lt;/span&gt;cfg&lt;span style="color: #990000"&gt;.&lt;/span&gt;AnnotationConfiguration&lt;span style="color: #990000"&gt;;&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #008080"&gt;Test&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #008080"&gt;SessionFactory&lt;/span&gt; sessionFactory&lt;span style="color: #990000"&gt;;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #008080"&gt;Session&lt;/span&gt; session&lt;span style="color: #990000"&gt;;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;void&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;main&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;String&lt;span style="color: #990000"&gt;[]&lt;/span&gt; args&lt;span style="color: #990000"&gt;)&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
        &lt;span style="color: #008080"&gt;URL&lt;/span&gt; url &lt;span style="color: #990000"&gt;=&lt;/span&gt; Test&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getResource&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"/hibernate.cfg.xml"&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
        sessionFactory &lt;span style="color: #990000"&gt;=&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;AnnotationConfiguration&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;().&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;configure&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;url&lt;span style="color: #990000"&gt;).&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;buildSessionFactory&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
        session &lt;span style="color: #990000"&gt;=&lt;/span&gt; sessionFactory&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getCurrentSession&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
        org&lt;span style="color: #990000"&gt;.&lt;/span&gt;hibernate&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="color: #008080"&gt;Transaction&lt;/span&gt; tx &lt;span style="color: #990000"&gt;=&lt;/span&gt; session&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;beginTransaction&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;

        &lt;span style="color: #008080"&gt;Query&lt;/span&gt; q &lt;span style="color: #990000"&gt;=&lt;/span&gt; session&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;createQuery&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"from Vehicle as v where v.id.makeId = 1"&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
        &lt;span style="color: #008080"&gt;List&amp;lt;Vehicle&amp;gt;&lt;/span&gt; lst &lt;span style="color: #990000"&gt;=&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;null&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;;&lt;/span&gt;
        lst &lt;span style="color: #990000"&gt;=&lt;/span&gt; q&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;list&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;if&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;lst&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;size&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;()&lt;/span&gt; &lt;span style="color: #990000"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;)&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
            &lt;span style="color: #008080"&gt;Vehicle&lt;/span&gt; v &lt;span style="color: #990000"&gt;=&lt;/span&gt; lst&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;get&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
            System&lt;span style="color: #990000"&gt;.&lt;/span&gt;out&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;v&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getName&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;());&lt;/span&gt;
            &lt;span style="color: #008080"&gt;Set&amp;lt;MakerCountry&amp;gt;&lt;/span&gt; makerCountries &lt;span style="color: #990000"&gt;=&lt;/span&gt; v&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getMakerCountries&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
            System&lt;span style="color: #990000"&gt;.&lt;/span&gt;out&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;makerCountries&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;size&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;());&lt;/span&gt;
        &lt;span style="color: #FF0000"&gt;}&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;}&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;}&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Nope.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;Hibernate: select vehicle0_.MAKE_ID as MAKE1_1_, vehicle0_.MODEL_ID as MODEL2_1_, vehicle0_.NAME as NAME1_ from MYSCHEMA.VEHICLE vehicle0_ where vehicle0_.MAKE_ID=1
Exception in thread "main" org.hibernate.HibernateException: Unable to resolve property: id.makeId&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Fine, we&amp;#8217;ll add the property ourselves.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;        ...
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"makeId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"int"&lt;/span&gt; &lt;span style="color: #009900"&gt;insert&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt; &lt;span style="color: #009900"&gt;update&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;set&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"makerCountries"&lt;/span&gt; &lt;span style="color: #009900"&gt;inverse&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt; &lt;span style="color: #009900"&gt;lazy&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"true"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;property-ref&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"makeId"&lt;/span&gt; &lt;span style="color: #009900"&gt;column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;one-to-many&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MakerCountry"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/set&amp;gt;&lt;/span&gt;&lt;/span&gt;
        ...&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Now umm&amp;#8230;&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;Hibernate: select vehicle0_.MAKE_ID as MAKE1_1_, vehicle0_.MODEL_ID as MODEL2_1_, vehicle0_.NAME as NAME1_ from MYSCHEMA.VEHICLE vehicle0_ where vehicle0_.MAKE_ID=1
Chevrolet Corvette
Exception in thread "main" org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: Vehicle.makerCountries, no session or session was closed&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;"no session or session was closed"?? What does that mean?&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Whatever, we&amp;#8217;ll set &lt;tt&gt;lazy&lt;/tt&gt; to &lt;tt&gt;false&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;        ...
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;set&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"makerCountries"&lt;/span&gt; &lt;span style="color: #009900"&gt;inverse&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt; &lt;span style="color: #009900"&gt;lazy&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        ...&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;and&amp;#8230;&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;Hibernate: select vehicle0_.MAKE_ID as MAKE1_1_, vehicle0_.MODEL_ID as MODEL2_1_, vehicle0_.NAME as NAME1_ from MYSCHEMA.VEHICLE vehicle0_ where vehicle0_.MAKE_ID=1
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;I think Luke Skywalker summed it up quite poignantly when he said&lt;/p&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;&lt;em&gt;NOOOOOOOOOOOOOO!!&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p align="right"&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-837545844093674335?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/837545844093674335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/06/compounding-hibernate-problems-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/837545844093674335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/837545844093674335'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/06/compounding-hibernate-problems-2.html' title='Compounding Hibernate Problems 2: The Enterprise Solution Strikes Back'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-5059926564675278444</id><published>2009-06-23T20:15:00.000-07:00</published><updated>2009-06-27T01:15:59.247-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><title type='text'>Lazy Hibernate</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Let&amp;#8217;s play with large collections.&lt;/p&gt;&lt;/div&gt; &lt;div class="listingblock"&gt; &lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;ddl&lt;/div&gt; &lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt; &lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;CREATE&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;TABLE&lt;/span&gt;&lt;/span&gt; popular_band &lt;span style="color: #990000"&gt;(&lt;/span&gt;
    band_id &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;AS&lt;/span&gt;&lt;/span&gt; INTEGER &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;PRIMARY&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;KEY&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    band_name &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;AS&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;VARCHAR&lt;/span&gt;
&lt;span style="color: #990000"&gt;);&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;CREATE&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;TABLE&lt;/span&gt;&lt;/span&gt; fan &lt;span style="color: #990000"&gt;(&lt;/span&gt;
    fan_id &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;AS&lt;/span&gt;&lt;/span&gt; INTEGER &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;PRIMARY&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;KEY&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    fan_name &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;AS&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;VARCHAR&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    favorite_band_id &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;AS&lt;/span&gt;&lt;/span&gt; INTEGER
&lt;span style="color: #990000"&gt;);&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;ALTER&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;TABLE&lt;/span&gt;&lt;/span&gt; fan &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;ADD&lt;/span&gt;&lt;/span&gt; fans_fk_popular_band &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;FOREIGN&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;KEY&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;favorite_band_id&lt;span style="color: #990000"&gt;)&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;REFERENCES&lt;/span&gt;&lt;/span&gt; popular_band&lt;span style="color: #990000"&gt;(&lt;/span&gt;band_id&lt;span style="color: #990000"&gt;);&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INSERT&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INTO&lt;/span&gt;&lt;/span&gt; popular_band &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;VALUES&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"Beatles"&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INSERT&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INTO&lt;/span&gt;&lt;/span&gt; fan &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;VALUES&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"Jim"&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INSERT&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INTO&lt;/span&gt;&lt;/span&gt; fan &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;VALUES&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;2&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"Bob"&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INSERT&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INTO&lt;/span&gt;&lt;/span&gt; fan &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;VALUES&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"Sue"&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INSERT&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INTO&lt;/span&gt;&lt;/span&gt; fan &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;VALUES&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;4&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"Mary"&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-style: italic"&gt;&lt;span style="color: #9A1900"&gt;-- 100,000 more ...&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INSERT&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;INTO&lt;/span&gt;&lt;/span&gt; fan &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;VALUES&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;100005&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"Alex"&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;After reverse engineering this schema with Hibernate, your mappings should look something like this.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;PopularBand.hbm.xml&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-mapping&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Mapping DTD 3.0//EN"&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"PopularBand"&lt;/span&gt; &lt;span style="color: #009900"&gt;table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"POPULAR_BAND"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"bandId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"long"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"BAND_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"bandName"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"string"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"BAND_NAME"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;set&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"fans"&lt;/span&gt; &lt;span style="color: #009900"&gt;inverse&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"true"&lt;/span&gt; &lt;span style="color: #009900"&gt;lazy&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"true"&lt;/span&gt; &lt;span style="color: #009900"&gt;table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAN"&lt;/span&gt; &lt;span style="color: #009900"&gt;fetch&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"select"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAVORITE_BAND_ID"&lt;/span&gt; &lt;span style="color: #009900"&gt;precision&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"10"&lt;/span&gt; &lt;span style="color: #009900"&gt;scale&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"0"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;one-to-many&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Fan"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/set&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/class&amp;gt;&lt;/span&gt;&lt;/span&gt;

    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Fan"&lt;/span&gt; &lt;span style="color: #009900"&gt;table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAN"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"fanId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"long"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAN_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"fanName"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"string"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAN_NAME"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;many-to-one&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"favoriteBand"&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"PopularBand"&lt;/span&gt; &lt;span style="color: #009900"&gt;fetch&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"select"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAVORITE_BAND_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/many-to-one&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/class&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;The Beatles, being a very popular band, have many fans. I just want to look at 10, in no particular order. That shouldn&amp;#8217;t be hard, right?&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;void&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;print10fans&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #008080"&gt;PopularBand&lt;/span&gt; pb&lt;span style="color: #990000"&gt;)&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
    &lt;span style="color: #008080"&gt;Set&amp;lt;Fan&amp;gt;&lt;/span&gt; fans &lt;span style="color: #990000"&gt;=&lt;/span&gt; pb&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getFans&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
    &lt;span style="color: #008080"&gt;Iterator&amp;lt;Fan&amp;gt;&lt;/span&gt; iter &lt;span style="color: #990000"&gt;=&lt;/span&gt; fans&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;iterator&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;for&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #009900"&gt;int&lt;/span&gt; i&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;;&lt;/span&gt; i &lt;span style="color: #990000"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #993399"&gt;10&lt;/span&gt; &lt;span style="color: #990000"&gt;&amp;amp;&amp;amp;&lt;/span&gt; iter&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;hasNext&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt; i&lt;span style="color: #990000"&gt;++)&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
        System&lt;span style="color: #990000"&gt;.&lt;/span&gt;out&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;iter&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;next&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;().&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getFanName&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;());&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;}&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;}&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;And the output is&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;java.lang.OutOfMemoryError: Java heap space
...&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Oops, our very large collection is very large. Maybe the manual can help us.&lt;/p&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;&lt;tt&gt;lazy&lt;/tt&gt; (optional - defaults to &lt;tt&gt;true&lt;/tt&gt;) may be used to disable lazy fetching
and specify that the association is always eagerly fetched, or to
enable "extra-lazy" fetching where most operations do not initialize the
collection (suitable for very large collections)&lt;/p&gt;&lt;/div&gt;
&lt;p align="right"&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Perfect! Just a quick change&lt;/p&gt;&lt;/div&gt;
&lt;div class="exampleblock" style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;set&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"fans"&lt;/span&gt; &lt;span style="color: #009900"&gt;inverse&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"true"&lt;/span&gt; &lt;span style="color: #009900"&gt;lazy&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"extra"&lt;/span&gt; &lt;span style="color: #009900"&gt;table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAN"&lt;/span&gt; &lt;span style="color: #009900"&gt;fetch&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"select"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
                                      ^^^^^&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;and we can try again.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;java.lang.OutOfMemoryError: Java heap space
...&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Ok, just what does this "extra-lazy" really mean anyway? The manual is very silent on such details, so we turn to &lt;a href="https://forum.hibernate.org/viewtopic.php?p=2375897#p2375897"&gt;other sources&lt;/a&gt; (&lt;em&gt;emphasis added&lt;/em&gt;).&lt;/p&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Extra lazy doesn&amp;#8217;t do much on sets. It is actually quite &lt;strong&gt;useful only on the size method&lt;/strong&gt; which triggers a select count on the database. However, &lt;strong&gt;iterating over a set will instantiate the whole collection&lt;/strong&gt;. On maps and lists, extra lazy also enables fetching an entry by index. Still &lt;strong&gt;iterating over a list or a map will fetch the whole collection&lt;/strong&gt; from database.&lt;/p&gt;&lt;/div&gt;
&lt;p align="right"&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;So when the manual says&lt;/p&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;&amp;#8230;most operations do not initialize the collection (suitable for very large collections)&lt;/p&gt;&lt;/div&gt;
&lt;p align="right"&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;it actually means&lt;/p&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;&amp;#8230;only the &lt;tt&gt;size()&lt;/tt&gt; method does not initialize the collection, unless it&amp;#8217;s a map or list, then you can also fetch by index (but otherwise your very large collection is destined to crash your program)&lt;/p&gt;&lt;/div&gt;
&lt;p align="right"&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;You can use "Filtering collections" to specify how many results you want, but doing that seems to turn the whole idea of &amp;#8220;Plain-Old-Java-Objects&amp;#8221; into &amp;#8220;Plain-Old-Java-Objects-Unless-Your-Collections-Are-Too-Big-Then-You-Have-To-Use-Framework-Specific-API&amp;#8221;&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-5059926564675278444?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/5059926564675278444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/06/lazy-hibernate.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/5059926564675278444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/5059926564675278444'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/06/lazy-hibernate.html' title='Lazy Hibernate'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-858921833483079461</id><published>2009-05-11T12:50:00.000-07:00</published><updated>2009-06-27T01:13:02.036-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><title type='text'>Fastest bulk import into sqlite</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I just wanted to populate a sqlite database with 100 million rows of data from a 1.8 gigabyte tab delimited file (tsv).&lt;/p&gt;&lt;/div&gt; &lt;div class="listingblock"&gt; &lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;commands.txt&lt;/div&gt; &lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt; &lt;pre&gt;&lt;tt&gt;.echo ON

.read create_table_without_pk.sql

PRAGMA cache_size = 400000;
PRAGMA synchronous = OFF;
PRAGMA journal_mode = OFF;
PRAGMA locking_mode = EXCLUSIVE;
PRAGMA count_changes = OFF;
PRAGMA temp_store = MEMORY;
PRAGMA auto_vacuum = NONE;

.separator "\t"
.import a_tab_seprated_table.txt mytable

BEGIN;
.read add_indexes.sql
COMMIT;

.exit&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;&lt;tt&gt;PRAGMA cache_size = 400000&lt;/tt&gt; lets sqlite allocate about 460MB of RAM to work with. You can find more detailed explaination of these PRAGMA options on the &lt;a href="http://www.sqlite.org/pragma.html"&gt;Sqlite site&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;sqlite3 mydb.db &amp;lt; commands.txt&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Using this approach, the inserting of data took only about 20 mins.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;However, adding a composite primary key (i.e. unique index) and a non-unique composite index ran for 70+ hours before I just canceled it.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;If you can pre-sort your data in the order it is indexed, the import speed is practically the same whether you create the index before or after the import. However, if you create the index before the import, the database data and indexes will be intermingled with each other, thus fragmented (but this won&amp;#8217;t affect the file size). The fragmentation can be corrected by running the &lt;tt&gt;VACUUM&lt;/tt&gt; command.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;There is a powerful &lt;strong&gt;ExternalSort&lt;/strong&gt; implementation as part of the &lt;a href="http://brie.di.unipi.it/smalltext/"&gt;Java Small Text library&lt;/a&gt;. Look under &lt;em&gt;Documentation&lt;/em&gt;&amp;#8594;&lt;em&gt;Small Text Utils tutorial&lt;/em&gt; for info about it.&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-858921833483079461?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/858921833483079461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/05/fastest-bulk-import-into-sqlite.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/858921833483079461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/858921833483079461'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/05/fastest-bulk-import-into-sqlite.html' title='Fastest bulk import into sqlite'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-9179740721442155077</id><published>2009-05-01T13:21:00.000-07:00</published><updated>2009-06-02T12:57:48.946-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><title type='text'>Compounding Hibernate Problems</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="listingblock"&gt; &lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;Platform information&lt;/div&gt; &lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt; &lt;pre&gt;&lt;tt&gt;Eclipse Platform
Version: 3.4.2
Build id: M20090211-1700

Hibernate Tools 3.2.4.GA-R200903141626-H5
and
Hibernate Tools 3.2.4.GA-N200904280907-H52

Windows XP Pro SP3

JRE 6

Tested on Oracle 10g and Apache Derby&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Two problems with Hibernate Tools reverse engineering:&lt;/p&gt;&lt;/div&gt;
&lt;div class="olist arabic"&gt;&lt;ol class="arabic"&gt;
&lt;li&gt;
&lt;p&gt;
Unable to create a relationship from a non-primary key column in one table to one column of a composite primary key in another table, and visa-versa.
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
Creating a relationship from a column in a composite primary key of one table to a non-primary key column in another table produces incorrect mapping file
    (I have submitted a &lt;a href="http://opensource.atlassian.com/projects/hibernate/browse/HBX-1123"&gt;poorly written bug report&lt;/a&gt; for this one).
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;These issues will be explorered in the following example. For simplicity we&amp;#8217;ll use an Apache Derby database.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Start the database, and connect to it.&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;jdbc:derby://localhost:1527/myDB;create=true;user=me;password=mine&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Create these tables in the &lt;tt&gt;myDB&lt;/tt&gt; database, in the &lt;tt&gt;ME&lt;/tt&gt; schema.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;ddl&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;create&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;table&lt;/span&gt;&lt;/span&gt; vehicles &lt;span style="color: #990000"&gt;(&lt;/span&gt;
    make_id integer&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    model_id integer&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    name &lt;span style="color: #009900"&gt;varchar&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;50&lt;/span&gt;&lt;span style="color: #990000"&gt;),&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;PRIMARY&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;KEY&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;make_id&lt;span style="color: #990000"&gt;,&lt;/span&gt; model_id&lt;span style="color: #990000"&gt;)&lt;/span&gt;
&lt;span style="color: #990000"&gt;);&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;create&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;table&lt;/span&gt;&lt;/span&gt; owners &lt;span style="color: #990000"&gt;(&lt;/span&gt;
    owner_id integer &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;PRIMARY&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;KEY&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    favorite_make_id integer&lt;span style="color: #990000"&gt;,&lt;/span&gt;
    name &lt;span style="color: #009900"&gt;varchar&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;20&lt;/span&gt;&lt;span style="color: #990000"&gt;)&lt;/span&gt;
&lt;span style="color: #990000"&gt;);&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicles &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Chevrolet Corvette'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicles &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Chevrolet Malibu'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicles &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;2&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Ford Focus'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicles &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;2&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Ford Mustang'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicles &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Honda Accord'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicles &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Honda Odyssey'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicles &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;4&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;0&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Toyota Avalon'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; vehicles &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;4&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Toyota Camry'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; owners &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;50&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Jim'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; owners &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;51&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Alex'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; owners &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;52&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;4&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Sue'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; owners &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;53&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;1&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Casey'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; owners &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;54&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Ted'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;insert&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;into&lt;/span&gt;&lt;/span&gt; owners &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;values&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;55&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;2&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #FF0000"&gt;'Mary'&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Create this Hibernate Configuration file.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;.cfg.xml&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt; &lt;span style="color: #009900"&gt;encoding&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"UTF-8"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-configuration&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt;
        &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Configuration DTD 3.0//EN"&lt;/span&gt;
        &lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-configuration&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;session-factory&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.connection.driver_class"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.apache.derby.jdbc.EmbeddedDriver&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.connection.url"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;jdbc:derby://localhost:1527/myDB&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.connection.username"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;me&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.connection.password"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;mine&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.dialect"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.hibernate.dialect.DerbyDialect&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.current_session_context_class"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;thread&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.default_schema"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;ME&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.show_sql"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;true&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/session-factory&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-configuration&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Setup a Hibernate Console Configuration with the configuration above and connection to the Derby database.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Create this Hibernate reverse engineering configuration.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;.reveng.xml&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt; &lt;span style="color: #009900"&gt;encoding&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"UTF-8"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-reverse-engineering&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-reverse-engineering&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table-filter&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;match-name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"OWNERS"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table-filter&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;match-name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLES"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;

    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"OWNERS"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;foreign-key&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;foreign-table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLES"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column-ref&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;local-column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAVORITE_MAKE_ID"&lt;/span&gt; &lt;span style="color: #009900"&gt;foreign-column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/foreign-key&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-reverse-engineering&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Setup a Hibernate Code Generation configuration like this:&lt;br /&gt;
 [&lt;a href="http://erictheturtlefiles.googlepages.com/20090501-CodeGenCfg1.png"&gt;Main tab&lt;/a&gt;] [&lt;a href="http://erictheturtlefiles.googlepages.com/20090501-CodeGenCfg2.png"&gt;Exporters tab&lt;/a&gt;]&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Trying to run it produces this error:&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;org.hibernate.MappingException: Foreign key (FK8BBD58205C954C50:OWNERS [FAVORITE_MAKE_ID])) must have same number of columns as the referenced primary key (VEHICLES [MAKE_ID,MODEL_ID])
Foreign key (FK8BBD58205C954C50:OWNERS [FAVORITE_MAKE_ID])) must have same number of columns as the referenced primary key (VEHICLES [MAKE_ID,MODEL_ID])&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Searching for &lt;a href="http://www.google.com/search?hl=en&amp;amp;q=%22must+have+same+number+of+columns+as+the+referenced+primary+key%22"&gt;"must have same number of columns as the referenced primary key" on Google&lt;/a&gt; returns 6 pages of results. You can find references to this error &lt;a href="http://www.myeclipseide.com/PNphpBB2-viewtopic-t-3302-start-15.html"&gt;as early as 2005&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 id="_the_other_way_incorrect"&gt;The Other Way (incorrect)&lt;/h4&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;So let&amp;#8217;s try the other way, even though it&amp;#8217;s incorrect.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Change the Hibernate reverse engineering configuration to this.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;.reveng.xml&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt; &lt;span style="color: #009900"&gt;encoding&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"UTF-8"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-reverse-engineering&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-reverse-engineering&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table-filter&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;match-name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"OWNERS"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table-filter&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;match-name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLES"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;

    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;table&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLES"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;foreign-key&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;foreign-table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"OWNERS"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column-ref&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;local-column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="color: #009900"&gt;foreign-column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAVORITE_MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/foreign-key&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-reverse-engineering&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Now the Code Generation configuration will run, but it produces an incorrect mapping file.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;Vehicles.hbm.xml&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-mapping&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Mapping DTD 3.0//EN"&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Vehicles"&lt;/span&gt; &lt;span style="color: #009900"&gt;table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLES"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;composite-id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"id"&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VehiclesId"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key-property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"makeId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"int"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/key-property&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key-property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"modelId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"int"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MODEL_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/key-property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/composite-id&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;many-to-one&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"owners"&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Owners"&lt;/span&gt; &lt;span style="color: #009900"&gt;update&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt; &lt;span style="color: #009900"&gt;insert&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt; &lt;span style="color: #009900"&gt;fetch&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"select"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="color: #009900"&gt;not-null&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"true"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/many-to-one&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"name"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"string"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"NAME"&lt;/span&gt; &lt;span style="color: #009900"&gt;length&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"50"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/class&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;The &lt;tt&gt;many-to-one&lt;/tt&gt; tag should have this additional attribute:&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;property-ref="favoriteMakeId"&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Because it doesn&amp;#8217;t, this code will fail:&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;Main.java&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;import&lt;/span&gt;&lt;/span&gt; org&lt;span style="color: #990000"&gt;.&lt;/span&gt;hibernate&lt;span style="color: #990000"&gt;.&lt;/span&gt;cfg&lt;span style="color: #990000"&gt;.&lt;/span&gt;AnnotationConfiguration&lt;span style="color: #990000"&gt;;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;import&lt;/span&gt;&lt;/span&gt; org&lt;span style="color: #990000"&gt;.&lt;/span&gt;hibernate&lt;span style="color: #990000"&gt;.*;&lt;/span&gt;

&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #008080"&gt;Main&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;

    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;void&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;main&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;String&lt;span style="color: #990000"&gt;[]&lt;/span&gt; args&lt;span style="color: #990000"&gt;)&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
        System&lt;span style="color: #990000"&gt;.&lt;/span&gt;out&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Connecting to Derby database."&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
        &lt;span style="color: #008080"&gt;SessionFactory&lt;/span&gt; sf &lt;span style="color: #990000"&gt;=&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;AnnotationConfiguration&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;().&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;configure&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;().&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;buildSessionFactory&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
        &lt;span style="color: #008080"&gt;Session&lt;/span&gt; session &lt;span style="color: #990000"&gt;=&lt;/span&gt; sf&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getCurrentSession&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;

        System&lt;span style="color: #990000"&gt;.&lt;/span&gt;out&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Querying for some vehciles."&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
        session&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;beginTransaction&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
        &lt;span style="color: #008080"&gt;Query&lt;/span&gt; q &lt;span style="color: #990000"&gt;=&lt;/span&gt; session&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;createQuery&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"from Vehicles as v where v.id.modelId = 0"&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
        java&lt;span style="color: #990000"&gt;.&lt;/span&gt;util&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="color: #008080"&gt;List&amp;lt;Vehicles&amp;gt;&lt;/span&gt; vehicleList &lt;span style="color: #990000"&gt;=&lt;/span&gt; q&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;list&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;

        System&lt;span style="color: #990000"&gt;.&lt;/span&gt;out&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Got "&lt;/span&gt; &lt;span style="color: #990000"&gt;+&lt;/span&gt; vehicleList&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;size&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;()&lt;/span&gt; &lt;span style="color: #990000"&gt;+&lt;/span&gt; &lt;span style="color: #FF0000"&gt;" matches."&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;

        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;for&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #008080"&gt;Vehicles&lt;/span&gt; vehicle &lt;span style="color: #990000"&gt;:&lt;/span&gt; vehicleList&lt;span style="color: #990000"&gt;)&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;

            System&lt;span style="color: #990000"&gt;.&lt;/span&gt;out&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Getting an owner that likes the maker of "&lt;/span&gt; &lt;span style="color: #990000"&gt;+&lt;/span&gt; vehicle&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getName&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;());&lt;/span&gt;
            &lt;span style="color: #008080"&gt;Owners&lt;/span&gt; owner &lt;span style="color: #990000"&gt;=&lt;/span&gt; vehicle&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getOwners&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;try&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
                System&lt;span style="color: #990000"&gt;.&lt;/span&gt;out&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;owner&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getName&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;()&lt;/span&gt; &lt;span style="color: #990000"&gt;+&lt;/span&gt; &lt;span style="color: #FF0000"&gt;" likes it."&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
            &lt;span style="color: #FF0000"&gt;}&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;catch&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #008080"&gt;ObjectNotFoundException&lt;/span&gt; ex&lt;span style="color: #990000"&gt;)&lt;/span&gt; &lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
                ex&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;printStackTrace&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
                System&lt;span style="color: #990000"&gt;.&lt;/span&gt;err&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"This fails because it was matching VEHCILES.MAKE_ID to OWNERS.OWNER_ID"&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
                System&lt;span style="color: #990000"&gt;.&lt;/span&gt;err&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;println&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"when it SHOULD have matched to OWNERS.FAVORITE_MAKE_ID like the reveng says."&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
            &lt;span style="color: #FF0000"&gt;}&lt;/span&gt;
        &lt;span style="color: #FF0000"&gt;}&lt;/span&gt;
    &lt;span style="color: #FF0000"&gt;}&lt;/span&gt;

&lt;span style="color: #FF0000"&gt;}&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Program output:&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;Connecting to Derby database.
Querying for some vehciles.
Hibernate: select vehicles0_.MAKE_ID as MAKE1_0_, vehicles0_.MODEL_ID as MODEL2_0_, vehicles0_.NAME as NAME0_ from ME.VEHICLES vehicles0_ where vehicles0_.MODEL_ID=0
Got 4 matches.
Getting an owner that likes the maker of Chevrolet Corvette
Hibernate: select owners0_.OWNER_ID as OWNER1_1_0_, owners0_.FAVORITE_MAKE_ID as FAVORITE2_1_0_, owners0_.NAME as NAME1_0_ from ME.OWNERS owners0_ where owners0_.OWNER_ID=?
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [Owners#1]
    at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:409)
    at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:108)
    at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:97)
    at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:140)
    at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
    at Owners_$$_javassist_1.getName(Owners_$$_javassist_1.java)
    at Main.main(Main.java:23)
This fails because it was matching VEHCILES.MAKE_ID to OWNERS.OWNER_ID
...&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;However, even if you manually add the &lt;tt&gt;property-ref&lt;/tt&gt;, when you run it with the example program, it returns an error of &amp;#8220;More than one row with the given identifier was found&amp;#8221;.&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;Connecting to Derby database.
Querying for some vehciles.
Hibernate: select vehicles0_.MAKE_ID as MAKE1_0_, vehicles0_.MODEL_ID as MODEL2_0_, vehicles0_.NAME as NAME0_ from ME.VEHICLES vehicles0_ where vehicles0_.MODEL_ID=0
Hibernate: select owners0_.OWNER_ID as OWNER1_1_0_, owners0_.FAVORITE_MAKE_ID as FAVORITE2_1_0_, owners0_.NAME as NAME1_0_ from ME.OWNERS owners0_ where owners0_.FAVORITE_MAKE_ID=?
Exception in thread "main" org.hibernate.HibernateException: More than one row with the given identifier was found: 1, for class: Owners
    at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:92)
    at org.hibernate.loader.entity.EntityLoader.loadByUniqueKey(EntityLoader.java:108)
    at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1672)
    at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:641)
    at org.hibernate.type.EntityType.resolve(EntityType.java:415)
    at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139)
    at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
    at org.hibernate.loader.Loader.doQuery(Loader.java:752)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    at org.hibernate.loader.Loader.doList(Loader.java:2228)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
    at org.hibernate.loader.Loader.list(Loader.java:2120)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
    at Main.main(Main.java:14)&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;This is because the example column has non-unique entries. If it only had unique entires, our manual &lt;tt&gt;property-ref&lt;/tt&gt; fix would work.&lt;/p&gt;&lt;/div&gt;
&lt;h4 id="_doing_it_manually"&gt;Doing it manually&lt;/h4&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Hibernate reverse engineering has pretty much no support for special table relationships (e.g. a non-inverse &lt;tt&gt;one-to-many&lt;/tt&gt;). The only real solution to this problem is to manually create the mapping files and classes yourself.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Some links that probably won&amp;#8217;t help at all:&lt;/p&gt;&lt;/div&gt;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://technicalmumbojumbo.wordpress.com/2007/09/25/investigating-hibernate-associations-many-to-many/"&gt;http://technicalmumbojumbo.wordpress.com/2007/09/25/investigating-hibernate-associations-many-to-many/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://javamug.org/mainpages/presentations/Hibernate-1x2.pdf"&gt;http://javamug.org/mainpages/presentations/Hibernate-1x2.pdf&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.experts-exchange.com/Programming/Languages/Java/J2EE/Q_22391187.html"&gt;http://www.experts-exchange.com/Programming/Languages/Java/J2EE/Q_22391187.html&lt;/a&gt; (see also Google cache of the page if the answers aren&amp;#8217;t shown)
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://devlicio.us/blogs/billy_mccafferty/archive/2008/07/11/when-to-use-many-to-one-s-vs-many-to-many-with-nhibernate.aspx"&gt;http://devlicio.us/blogs/billy_mccafferty/archive/2008/07/11/when-to-use-many-to-one-s-vs-many-to-many-with-nhibernate.aspx&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.jroller.com/RickHigh/entry/hibernate_referencing_a_component_of"&gt;http://www.jroller.com/RickHigh/entry/hibernate_referencing_a_component_of&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-153"&gt;http://opensource.atlassian.com/projects/hibernate/browse/HHH-153&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Trying to use a &lt;tt&gt;composite-id&lt;/tt&gt; with &lt;tt&gt;key-many-to-one&lt;/tt&gt; won&amp;#8217;t work because the foreign column &lt;a href="http://www.xylax.net/hibernate/compositeid.html"&gt;needs to be a primary key&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Here is how the mapping of Vehicles &amp;#8594; Owners &lt;em&gt;should&lt;/em&gt; be:&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;Vehicles.hbm.xml&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-mapping&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Mapping DTD 3.0//EN"&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Vehicles"&lt;/span&gt; &lt;span style="color: #009900"&gt;table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"VEHICLES"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;composite-id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;mapped&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key-property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"makeId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"int"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/key-property&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key-property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"modelId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"int"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MODEL_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/key-property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/composite-id&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"name"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"string"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"NAME"&lt;/span&gt; &lt;span style="color: #009900"&gt;length&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"50"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;bag&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"owners"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAVORITE_MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;one-to-many&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Owners"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/bag&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/class&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Some problems here:&lt;/p&gt;&lt;/div&gt;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
Any kind of collection mapping (&lt;tt&gt;set&lt;/tt&gt;, &lt;tt&gt;list&lt;/tt&gt;, &lt;tt&gt;bag&lt;/tt&gt;, &lt;tt&gt;array&lt;/tt&gt;, &lt;tt&gt;map&lt;/tt&gt;) &lt;em&gt;require&lt;/em&gt; a &lt;tt&gt;key&lt;/tt&gt; element be defined.
&lt;/li&gt;
&lt;li&gt;
The &lt;tt&gt;key&lt;/tt&gt; generates an error because it doesn&amp;#8217;t map the &amp;#8220;same number of columns&amp;#8221; (i.e. it needs 2 columns to match the 2 column primary key). It&amp;#8217;s saying it needs another &lt;tt&gt;key&lt;/tt&gt; defined.
&lt;/li&gt;
&lt;li&gt;
So why not just get rid of the primary key? Because the &lt;tt&gt;class&lt;/tt&gt; element &lt;em&gt;requires&lt;/em&gt; a &lt;tt&gt;id&lt;/tt&gt; or &lt;tt&gt;composite-id&lt;/tt&gt; element. And we can&amp;#8217;t make just &lt;tt&gt;MAKE_ID&lt;/tt&gt; or &lt;tt&gt;MODEL_ID&lt;/tt&gt; the primary key because those won&amp;#8217;t be unique.
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;h4 id="_solution"&gt;Solution&lt;/h4&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;At long last! For Owners &amp;#8594; Vehicles, this actually works.&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title" style="font-family: sans-serif; font-weight: bold;"&gt;Owners.hbm.xml&lt;/div&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;?xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;version&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"1.0"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;lt;!DOCTYPE&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;hibernate-mapping&lt;/span&gt; &lt;span style="color: #009900"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: #FF0000"&gt;"-//Hibernate/Hibernate Mapping DTD 3.0//EN"&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000080"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Owners"&lt;/span&gt; &lt;span style="color: #009900"&gt;table&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"OWNERS"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"ownerId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"int"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"OWNER_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;generator&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"assigned"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"favoriteMakeId"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"int"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"FAVORITE_MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"name"&lt;/span&gt; &lt;span style="color: #009900"&gt;type&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"string"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;column&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"NAME"&lt;/span&gt; &lt;span style="color: #009900"&gt;length&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"20"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;set&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"vehicles"&lt;/span&gt; &lt;span style="color: #009900"&gt;inverse&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"false"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;key&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;property-ref&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"favoriteMakeId"&lt;/span&gt; &lt;span style="color: #009900"&gt;column&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"MAKE_ID"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;one-to-many&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;class&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"Vehicles"&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/set&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/class&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;There still doesn&amp;#8217;t appear to be any method to properly associate Vehicles &amp;#8594; Owners, but thankfully the mapping file above is all I really need for my case.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;There also doesn&amp;#8217;t appear to be any way to produce a mapping file like this using Hibernate Tools reverse engineering, so I just have to make it manually.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Going back through some of the many links I visited while searching for help, I noticed &lt;a href="http://www.mycoolbutton.com/blog/index.php/tutorial/how-to-configure-a-composite-foreign-key-in-hibernate-30/"&gt;this page&lt;/a&gt; also basically explains the solution above.&lt;/p&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-9179740721442155077?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/9179740721442155077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/05/compounding-hibernate-problems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/9179740721442155077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/9179740721442155077'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/05/compounding-hibernate-problems.html' title='Compounding Hibernate Problems'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-5403032960500890710</id><published>2009-04-28T10:11:00.001-07:00</published><updated>2009-06-02T12:58:00.852-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><title type='text'>How to build Hibernate Core...I think?</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Checkout the lastest SVN trunk from &lt;a href="http://anonsvn.jboss.org/repos/hibernate/core/trunk"&gt;http://anonsvn.jboss.org/repos/hibernate/core/trunk&lt;/a&gt;.&lt;br /&gt; &lt;em&gt;I got rev 16450&lt;/em&gt;&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Set your &lt;tt&gt;JAVA_HOME&lt;/tt&gt; environment variable to a Java 5 JDK (it &lt;a href="http://lists.jboss.org/pipermail/hibernate-issues/2007-February/003784.html"&gt;fails with Java 6&lt;/a&gt;).&lt;br /&gt; &lt;em&gt;Mine is set to C:\Program Files\Java\jdk1.5.0_17&lt;/em&gt;&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Edit &lt;tt&gt;parent/pom.xml&lt;/tt&gt; to add  &lt;a href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-3204"&gt;these lines&lt;/a&gt; in bold.&lt;/p&gt;&lt;/div&gt; &lt;div class="listingblock"&gt; &lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt; &lt;pre&gt;&lt;tt&gt;...
         &amp;lt;/mailingList&amp;gt;
     &amp;lt;/mailingLists&amp;gt;


    &lt;strong&gt;&amp;lt;repositories&amp;gt;
        &amp;lt;repository&amp;gt;
            &amp;lt;id&amp;gt;jboss&amp;lt;/id&amp;gt;
            &amp;lt;url&amp;gt;http://repository.jboss.com/maven2/&amp;lt;/url&amp;gt;
        &amp;lt;/repository&amp;gt;

        &amp;lt;repository&amp;gt;
            &amp;lt;id&amp;gt;jboss-snapshot&amp;lt;/id&amp;gt;
            &amp;lt;url&amp;gt;http://snapshots.jboss.org/maven2&amp;lt;/url&amp;gt;
            &amp;lt;snapshots&amp;gt;
                &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;
            &amp;lt;/snapshots&amp;gt;
            &amp;lt;releases&amp;gt;
                &amp;lt;enabled&amp;gt;false&amp;lt;/enabled&amp;gt;
            &amp;lt;/releases&amp;gt;
        &amp;lt;/repository&amp;gt;
    &amp;lt;/repositories&amp;gt;
    &amp;lt;pluginRepositories&amp;gt;
        &amp;lt;pluginRepository&amp;gt;
            &amp;lt;id&amp;gt;jboss&amp;lt;/id&amp;gt;
            &amp;lt;url&amp;gt;http://repository.jboss.com/maven2/&amp;lt;/url&amp;gt;
        &amp;lt;/pluginRepository&amp;gt;
    &amp;lt;/pluginRepositories&amp;gt;&lt;/strong&gt;


     &amp;lt;build&amp;gt;
         &amp;lt;plugins&amp;gt;
             &amp;lt;plugin&amp;gt;
...&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Download &lt;a href="http://maven.apache.org/download.html"&gt;Maven&lt;/a&gt;.&lt;br /&gt;
&lt;em&gt;I got apache-maven-2.1.0-bin.zip&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Unpack Maven somewhere, &lt;tt&gt;cd&lt;/tt&gt; to the hibernate-core trunk directory and run this command.&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;&lt;strong&gt;&amp;lt;path to apache-maven&amp;gt;&lt;/strong&gt;/bin/mvn package&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;This should automatically download everything, build the whole thing, and run the tests.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;My test results were&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;Tests run: 117, Failures: 0, Errors: 56, Skipped: 0&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;At this point I have no idea what to do&amp;#8230;&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-5403032960500890710?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/5403032960500890710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/how-to-build-hibernate-corei-think.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/5403032960500890710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/5403032960500890710'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/how-to-build-hibernate-corei-think.html' title='How to build Hibernate Core...I think?'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-2742440067379975438</id><published>2009-04-24T12:55:00.001-07:00</published><updated>2009-06-02T12:58:16.246-07:00</updated><title type='text'>Highlighting Code Snippets</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Windows Live Writer seems to be a popular blogging client, especially with the Code Formatting plugin. After the last post however, its shortcomings became very apparent. The writer&amp;#8217;s formatting is fickle and limited. The code formatter is messy and unreliable (it refused to highlight the code in the last post).&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;It&amp;#8217;s sad that with all our technology, we still have yet to make very reliable WYSIWYG text editors. That means writing HTML directly, or finding an intermediate markup language to do the job. So I setup and tried two  &lt;a href="http://en.wikipedia.org/wiki/Lightweight_markup_language"&gt;lightweight markup language&lt;/a&gt; for writing blog posts.&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;h4 id="_restructuredtext"&gt;reStructuredText&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;&lt;a href="http://docutils.sourceforge.net/docs/user/rst/quickref.html"&gt;reStructuredText&lt;/a&gt; has been officially accepted as the Python inline code documentation formatter. It currently doesn&amp;#8217;t handle code formatting, but it&amp;#8217;s &lt;a href="http://docutils.sourceforge.net/sandbox/code-block-directive/"&gt;in the works&lt;/a&gt;.  &lt;a href="http://www.eflorenzano.com/blog/tag/restructured-text/"&gt;This fellow&lt;/a&gt; notes that  &lt;a href="http://pygments.org/"&gt;Pygments&lt;/a&gt; already has a way to integrate with reStructuredText. It took a lot of finagling (and realizing my &lt;tt&gt;PATH&lt;/tt&gt; was wrong), but I got it working.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Here&amp;#8217;s what I did (perhaps not the best way)&lt;/p&gt;&lt;/div&gt; &lt;div class="ulist"&gt;&lt;ul&gt; &lt;li&gt; Download &lt;a href="http://docutils.sourceforge.net/"&gt;Docutils&lt;/a&gt; and unpack it. &lt;/li&gt; &lt;li&gt; Run &lt;tt&gt;setup.py build&lt;/tt&gt; which creates a &lt;em&gt;build&lt;/em&gt; directory &lt;/li&gt; &lt;li&gt; Move all the files in the &lt;em&gt;build/scripts-2.5&lt;/em&gt; directory to the &lt;em&gt;build/lib&lt;/em&gt; directory &lt;/li&gt; &lt;li&gt; Running &lt;tt&gt;rst2html.py&lt;/tt&gt; will now work, but it can&amp;#8217;t do highlighting yet &lt;/li&gt; &lt;li&gt; Download the Pygments source and &lt;tt&gt;.egg&lt;/tt&gt; file for the proper Python version &lt;/li&gt; &lt;li&gt; Randomly run a bunch of commands on the Pygments source and/or &lt;tt&gt;.egg&lt;/tt&gt; until it somehow gets installed as a Python lib (yes, that&amp;#8217;s pretty much what happened) &lt;/li&gt; &lt;li&gt; Find the &lt;tt&gt;rst-directive.py&lt;/tt&gt; file amidst the Pygments source, copy its contents, and paste it into &lt;tt&gt;rst2html.py&lt;/tt&gt; right before the last line of that file. &lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;reStructuredText will now recognize the &lt;tt&gt;sourcecode&lt;/tt&gt; directive. There are other options you can set in that Pygments directive code (such as enabling the &lt;tt&gt;:linenos:&lt;/tt&gt; option).&lt;/p&gt;&lt;/div&gt; &lt;h4 id="_asciidoc"&gt;asciidoc&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;&lt;a href="http://www.methods.co.nz/asciidoc/"&gt;asciidoc&lt;/a&gt; works right out of the box, but needs &lt;a href="http://www.gnu.org/software/src-highlite/"&gt;GNU source-highlight&lt;/a&gt; for code highlighting (although I guess you could hack it to use whatever else you want). You can download a &lt;em&gt;very&lt;/em&gt; old &lt;a href="http://gnuwin32.sourceforge.net/packages/source-highlight.htm"&gt;Windows binary&lt;/a&gt;, but the latest version has many more highlighters that aren&amp;#8217;t compatible with older versions.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Since source-highlight needs some of the &lt;em&gt;boost&lt;/em&gt; libraries. I didn&amp;#8217;t have much hope in building it with MinGW, so I just went with the Cygwin build. The build process is pretty painless:&lt;/p&gt;&lt;/div&gt; &lt;div class="ulist"&gt;&lt;ul&gt; &lt;li&gt; Using the Cygwin setup, download the &lt;em&gt;boost&lt;/em&gt; libraries under the &lt;em&gt;Devel&lt;/em&gt; category. &lt;/li&gt; &lt;li&gt; Downloaded the latest release of source-highlight &lt;/li&gt; &lt;li&gt; Unpack it into a path without spaces (the build with fail otherwise) &lt;/li&gt; &lt;li&gt; Fire up the Cygwin shell and &lt;tt&gt;cd&lt;/tt&gt; into the directory &lt;/li&gt; &lt;li&gt; 10+ minutes of &lt;tt&gt;./configure&lt;/tt&gt;, &lt;tt&gt;make&lt;/tt&gt;, and &lt;tt&gt;make install&lt;/tt&gt;, and you&amp;#8217;re done &lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Running &lt;tt&gt;asciidoc.py&lt;/tt&gt; with the &lt;tt&gt;-s&lt;/tt&gt; option removes the HTML header/footers, and source-highlight inlines all its CSS with the code. After getting it working, I recreated the &lt;a href="http://erictheturtlefiles.googlepages.com/20090420-Hibernate_Compare.ad.txt"&gt;last post in asciidoc format&lt;/a&gt;, and replaced the post with the generated output.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;It looks &lt;em&gt;really&lt;/em&gt; nice.&lt;/p&gt;&lt;/div&gt; &lt;h4 id="_blogging_with_asciidoc"&gt;Blogging with asciidoc&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;All-in-all, asciidoc is very usable and powerful, but it does a lot more than I wanted, and the syntax isn&amp;#8217;t as natural as I would like.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;By default asciidoc and the blogspot styling don&amp;#8217;t completely get along. The &lt;tt&gt;listingblock&lt;/tt&gt;s don&amp;#8217;t have the &lt;tt&gt;overflow: auto&lt;/tt&gt; style, and it takes some tweaking to fix it for both Firefox and IE. There is also a lot of extra spacing added due to several layers of tags, but that&amp;#8217;s not hard to fix.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I started an &lt;a href="http://erictheturtlefiles.googlepages.com/asciidoc.xml"&gt;asciidoc syntax configuration for jEdit&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I wonder if there&amp;#8217;s a way to create a tool &lt;a href="http://srackham.wordpress.com/blogpost1/"&gt;like this&lt;/a&gt; for blogspot.&lt;/p&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-2742440067379975438?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/2742440067379975438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/highlighting-code-snippets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/2742440067379975438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/2742440067379975438'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/highlighting-code-snippets.html' title='Highlighting Code Snippets'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-4482922761273958420</id><published>2009-04-20T13:20:00.000-07:00</published><updated>2009-10-04T08:02:02.817-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><title type='text'>Comparison of Hibernate with Netbeans and Eclipse</title><content type='html'>&lt;h4 id="_netbeans_6_5_1_with_hibernate_support_plugin_1_0_3"&gt;Netbeans 6.5.1 with Hibernate Support plugin 1.0.3&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Looks like the new Netbeans 6.7 has really improved Hibernate reverse-engineering support.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Netbeans&amp;#8217;s Hibernate implementation is pleasantly simple, however its reverse-engineering is currently incomplete. If you want a straight-forward introduction to Java and Hibernate, Netbeans is the perfect way to go. But as soon as you want more powerful visual reverse-engineering tools, you&amp;#8217;d best switch to Eclipse.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Steps to use Hibernate in Netbeans&lt;/p&gt;&lt;/div&gt; &lt;div class="ulist"&gt;&lt;ul&gt; &lt;li&gt; Add Hibernate Support plugin &lt;/li&gt; &lt;li&gt; Setup a database connection in the Services window &lt;/li&gt; &lt;li&gt; Create a new Java Application project &lt;/li&gt; &lt;li&gt; Create a new Hibernate Configuration File (hibernate.cfg.xml) &lt;div class="ulist"&gt;&lt;ul&gt; &lt;li&gt; Select the database connection &lt;/li&gt; &lt;li&gt; press Finish &lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; &lt;/li&gt; &lt;li&gt; Edit the hibernate.cfg.xml and add these properties &lt;div class="exampleblock" style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt; &lt;pre&gt;&lt;tt&gt;&lt;span style="color: #009900"&gt;hibernate.show_sql &lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt; true &lt;span style="font-style: italic"&gt;&lt;span style="color: #9A1900"&gt;# under Configuration Properties (optional)&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #009900"&gt;hibernate.current_session_context_class &lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt; thread &lt;span style="font-style: italic"&gt;&lt;span style="color: #9A1900"&gt;# under Miscellaneous Properties&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Create new &amp;#8220;Hibernate Mapping Files and POJOs from Database&amp;#8221;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
select the configuration file
&lt;/li&gt;
&lt;li&gt;
choose the tables to reverse engineer
&lt;/li&gt;
&lt;li&gt;
check &amp;#8220;JDK 5 Language Features&amp;#8221; to get type-safe generics
&lt;/li&gt;
&lt;li&gt;
select a package where reverse engineered classes will go
&lt;/li&gt;
&lt;li&gt;
press Finish
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Create new &amp;#8220;HibernateUtil.java&amp;#8221;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
So Hibernate can find the configuration file even if it&amp;#8217;s in the jar, I recommend changing the line
&lt;div class="exampleblock" style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;sessionFactory &lt;span style="color: #990000"&gt;=&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;AnnotationConfiguration&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;().&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;configure&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;().&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;buildSessionFactory&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;to&lt;/p&gt;&lt;/div&gt;
&lt;div class="exampleblock" style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="color: #008080"&gt;URL&lt;/span&gt; cfgurl &lt;span style="color: #990000"&gt;=&lt;/span&gt; HibernateUtil&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getResource&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.cfg.xml"&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
sessionFactory &lt;span style="color: #990000"&gt;=&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;AnnotationConfiguration&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;().&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;configure&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;cfgurl&lt;span style="color: #990000"&gt;).&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;buildSessionFactory&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;There&amp;#8217;s currently no way to regenerate the reverse-engineered code once it&amp;#8217;s been generated. &lt;a href="http://forums.netbeans.org/ntopic4792.html"&gt;This thread&lt;/a&gt; says it is &amp;#8220;targeted as part of the next release&amp;#8221; (Netbeans 6.7 in June '09).&lt;/p&gt;&lt;/div&gt;
&lt;h4 id="_eclipse_3_4_2_with_hibernate_tools_addon_3_2_4"&gt;Eclipse 3.4.2 with Hibernate Tools addon 3.2.4&lt;/h4&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Is it just me, or is it really hard to find up-to-date information on the web about setting up Hibernate in Eclipse? There is &lt;a href="http://iablog.sybase.com/paulley/2009/02/reverse-engineering-sql-anywhere-with-hibernate-tools-part-trois/"&gt;one tutorial&lt;/a&gt; that doesn&amp;#8217;t seem too old, and covers most of my steps listed below.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Being new to Eclipse, it might be difficult to figure out there are actually 2 different addons you can download: Hibernate Tools, and &lt;a href="http://hibernatesynch.sourceforge.net/"&gt;Hibernate Synchronizer&lt;/a&gt; (last release 3 years ago?). There&amp;#8217;s also MyEclipse that costs money but probably makes the whole process more seamless. To get started in Eclipse, it might be useful to understand &lt;a href="http://www.ibm.com/developerworks/opensource/library/os-eclipse-master2/index.html"&gt;how Eclipse&lt;/a&gt; &lt;a href="http://www.vogella.de/articles/Eclipse/article.html"&gt;does Java&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;There are 4 different configurations to be aware of for Eclipse Hibernate Tools:&lt;/p&gt;&lt;/div&gt;
&lt;div class="olist arabic"&gt;&lt;ol class="arabic"&gt;
&lt;li&gt;
&lt;p&gt;
The Configuration file (hibernate.cfg.xml), used by the Console Configuration (technically optional because most if not all of these settings can be made in the Console Configuration)
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
The Console Configuration, used when creating the Reverse Engineering file, and by the Hibernate Code Generation configuration
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
The Reverse Engineering file (hibernate.regeng.xml) used by the Hibernate Code Generation configuration
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
The Hibernate Code Generation configuration
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;So with plain Eclipse, here&amp;#8217;s how you setup Hibernate Tools.&lt;/p&gt;&lt;/div&gt;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
Find the URL to the Eclipse Hibernate Tool addon
&lt;/li&gt;
&lt;li&gt;
Add the site to the Software Updates and install the addon
&lt;/li&gt;
&lt;li&gt;
Find all the libraries necessary to use Hibernate in your program and download them
&lt;/li&gt;
&lt;li&gt;
Create a new Java Project
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
under the Libraries tab, add all those Hibernate libraries
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Open up the project properties
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
in Hibernate Settings, check &amp;#8220;Enable Hibernate 3 support&amp;#8221;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Create a new Hibernate Configuration file (hibernate.cfg.xml)&lt;br /&gt;
    &lt;em&gt;Note that this configuration file is only to be used by the Console Configuration&lt;/em&gt;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
select database dialect
&lt;/li&gt;
&lt;li&gt;
select driver class
&lt;/li&gt;
&lt;li&gt;
enter the connection URL
&lt;/li&gt;
&lt;li&gt;
check &amp;#8220;Create a console configuration&amp;#8221;
&lt;/li&gt;
&lt;li&gt;
press Finish
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Edit the hibernate.cfg.xml and add these properties
&lt;div class="exampleblock" style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.current_session_context_class"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;thread&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900"&gt;name&lt;/span&gt;&lt;span style="color: #990000"&gt;=&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.show_sql"&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;true&lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;/span&gt;  &lt;span style="font-style: italic"&gt;&lt;span style="color: #9A1900"&gt;&amp;lt;!-- optional --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Create a new Hibernate Reverse Engineering file
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
select the Console Configuration you just made and press Refresh
&lt;/li&gt;
&lt;li&gt;
select which tables to reverse engineer
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Create a new Hibernate Code Generation configuration
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
select the Console Configuration
&lt;/li&gt;
&lt;li&gt;
select the Output Directory (if the output directory contains your hibernate.cfg.xml, it will be overwritten by this task)
&lt;/li&gt;
&lt;li&gt;
check &amp;#8220;Reverse Engineer from JDBC Connection&amp;#8221;
&lt;/li&gt;
&lt;li&gt;
enter the regeng.xml file you created
&lt;/li&gt;
&lt;li&gt;
under Exporters tab
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
check &amp;#8220;Use Java 5 syntax&amp;#8221; to get type-safe generics
&lt;/li&gt;
&lt;li&gt;
check the following Exporters: Domain code, Hibernate XML Mappings, Hibernate XML Configuration
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
press Run
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
At this point your original Hibernate Configuration file could be replaced by the new one created by the Code Generation, or you can keep them separate
&lt;/li&gt;
&lt;li&gt;
There&amp;#8217;s no HibernateUtil generator, but all you really need is this
&lt;div class="exampleblock" style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="color: #008080"&gt;URL&lt;/span&gt; cfgurl &lt;span style="color: #990000"&gt;=&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getClass&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;().&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getResource&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #FF0000"&gt;"hibernate.cfg.xml"&lt;/span&gt;&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="color: #008080"&gt;SessionFactory&lt;/span&gt; sf &lt;span style="color: #990000"&gt;=&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;AnnotationConfiguration&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;().&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;configure&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;cfgurl&lt;span style="color: #990000"&gt;).&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;buildSessionFactory&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;hr /&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;In my specific case, I&amp;#8217;m using Oracle 10g and the tables are in a schema named &lt;tt&gt;anotherschema&lt;/tt&gt;. There are some things to watch out for.&lt;/p&gt;&lt;/div&gt;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
Add the Oracle jdbc driver jar to your project libraries.
&lt;/li&gt;
&lt;li&gt;
Case sensitivity!
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Netbeans:&lt;/p&gt;&lt;/div&gt;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
Add the schema to the database connection properties after it&amp;#8217;s created (this also means each schema needs a separate connection).
&lt;/li&gt;
&lt;li&gt;
Has a problem that prevents me from reverse-engineering a database more than once without restarting the IDE (error says table &amp;#8220;cannot be added because it does not have a primary key&amp;#8221;).
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Eclipse:&lt;/p&gt;&lt;/div&gt;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
Most places that need to read or refresh the database schema will often freeze Eclipse.
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-4482922761273958420?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/4482922761273958420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/comparison-of-hibernate-with-netbeans.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/4482922761273958420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/4482922761273958420'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/comparison-of-hibernate-with-netbeans.html' title='Comparison of Hibernate with Netbeans and Eclipse'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-8337375835503337027</id><published>2009-04-10T20:41:00.001-07:00</published><updated>2009-06-02T12:56:49.928-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Installing Linux on a Toshiba Satellite T1960CS</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Some time back in 2007 I had the notion to install Linux on an ancient laptop I had sitting around. I figured it might be useful as a resident machine for torrents, a small web server, or even a router.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;This was originally posted on a page at &lt;a href="http://atwiki.com"&gt;atwiki.com&lt;/a&gt;, but somehow got deleted. Thankfully archive.org had picked it up, so here it is again, all cleaned up.&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;h4 id="_the_computer"&gt;The Computer&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Toshiba Satellite T1960CS&lt;/p&gt;&lt;/div&gt; &lt;div class="ulist"&gt;&lt;ul&gt; &lt;li&gt; 486, 66Mhz &lt;/li&gt; &lt;li&gt; 20MB RAM &lt;/li&gt; &lt;li&gt; 600MB HD &lt;/li&gt; &lt;li&gt; VGA display &lt;/li&gt; &lt;li&gt; PS/2 Keyboard and Mouse ports &lt;/li&gt; &lt;li&gt; 3.5'' floppy drive &lt;/li&gt; &lt;li&gt; Serial Port &lt;/li&gt; &lt;li&gt; Parallel Port &lt;/li&gt; &lt;li&gt; PCMCIA Ethernet IC-Card+ &lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;No CD drive. No USB port.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;This computer also has a known habit of not liking certain types of boot floppies. The floppy will be perfectly fine, and will boot on any other computer. Distasteful floppies make the Toshiba respond with the very detailed message of: &amp;#8220;Boot failed&amp;#8221;. The Goal&lt;/p&gt;&lt;/div&gt; &lt;h4 id="_install_some_linux_onto_the_toshiba_t1960cs"&gt;Install some Linux onto the Toshiba T1960CS&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;The approach suggested in the &lt;a href="http://damnsmalllinux.org/"&gt;Damn Small Linux&lt;/a&gt; page:&lt;/p&gt;&lt;/div&gt; &lt;div class="ulist"&gt;&lt;ul&gt; &lt;li&gt; Find a tiny distro that can boot from floppy disk &lt;/li&gt; &lt;li&gt; Ensure the tiny distro can enable interweb abilities &lt;/li&gt; &lt;li&gt; Download and install the real distro of choice to the lappy &lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; &lt;h4 id="_tiny_distros"&gt;Tiny Distros&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;DSL suggests &lt;a href="http://www.toms.net/rb/"&gt;TOMSRTBT&lt;/a&gt;. I never figured out how to enable PCMCIA with that distro (maybe some guru knows how). DSL also suggests &lt;a href="http://freshmeat.net/projects/bgrescue/"&gt;BGRescue&lt;/a&gt;, but that floppy gave a &amp;#8220;Boot failed&amp;#8221;.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Other tiny distros tested:&lt;/p&gt;&lt;/div&gt; &lt;div class="ulist"&gt;&lt;ul&gt; &lt;li&gt; &lt;a href="http://www.xinilux.us/olaf/"&gt;http://www.xinilux.us/olaf/&lt;/a&gt; &amp;#8592; &amp;#8220;Boot failed&amp;#8221; &lt;/li&gt; &lt;li&gt; &lt;a href="http://www.xinilux.us/portable_coyote/"&gt;http://www.xinilux.us/portable_coyote/&lt;/a&gt; &amp;#8592; &amp;#8220;Boot failed&amp;#8221; &lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Finally: &lt;a href="http://distro.ibiblio.org/pub/linux/distributions/baslinux/"&gt;http://distro.ibiblio.org/pub/linux/distributions/baslinux/&lt;/a&gt;&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Boots! detects network card (with some tweaking)!&lt;/p&gt;&lt;/div&gt; &lt;h4 id="_basiclinux"&gt;BasicLinux&lt;/h4&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Boots from 2 floppies. First floppy can be made with simple dd command. Second floppy needs to be formatted MS-DOS, and you copy the tar.gz file onto it.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;This thing actually has an X server, with some very basic applications.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;After booting with the first disk, do the following:&lt;/p&gt;&lt;/div&gt; &lt;h5 id="_1_partition_and_format_the_hard_drive"&gt;1) Partition and format the hard drive&lt;/h5&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I chose a main partition, and a 64mb swap partition.&lt;/p&gt;&lt;/div&gt; &lt;div class="listingblock"&gt; &lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt; &lt;pre&gt;&lt;tt&gt;$ fdisk /dev/hda
: d (delete existing partitions)

: n (new partition)
: p (primary partition)
: 1 (partition 1)
: &amp;lt;Return&amp;gt; (first cylinder)
: +636M (last cylinder)

: n (new partition)
: p (primary partition)
: 2 (partition 2)
: &amp;lt;Return&amp;gt; (start where partition 1 left off)
: &amp;lt;Return&amp;gt; (to the end of the disk)

: a (make a partition bootable)
: 1 (partition 1)

: t (type of partition)
: 2 (partition 2)
: 82 (hex code for swap partition)

: p (check that the partitions are correct)

: w (write the partitions)&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;h5 id="_2_format_the_partitions"&gt;2) Format the partitions&lt;/h5&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;$ mke2fs -c /dev/hda1
$ mkswap -c /dev/hda2&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h5 id="_3_mount_the_drive"&gt;3) Mount the drive&lt;/h5&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;$ mount /dev/hda1 /hd&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h5 id="_4_basiclinux_to_hd"&gt;4) BasicLinux to HD&lt;/h5&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;install-to-hd&lt;/p&gt;&lt;/div&gt;
&lt;div class="olist arabic"&gt;&lt;ol class="arabic"&gt;
&lt;li&gt;
&lt;p&gt;
reboot the system with floppy 1 in the drive
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
press CTRL when you see LILO
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
enter this: &lt;tt&gt;hd root=/dev/hda1&lt;/tt&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
execute: &lt;tt&gt;lilo -v&lt;/tt&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
get the bas2hd package
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
insert the disk, copy bas-hd.tgz to /tmp, and run &lt;tt&gt;go&lt;/tt&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
Edit &lt;tt&gt;/etc/rc.hd&lt;/tt&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Now that I have a drive ready and waiting, I need to get to the interweb.&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;$ edit /etc/rc.hd&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Comment out these two lines&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;e2fsck -pf /dev/xxxx 2&amp;gt;/dev/null
mount -avt nonfs&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Uncomment this line&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;# /etc/pcmcia/start&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Add the following lines at the end (self assigned IP and netmask, default gateway, your DNS servers)&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;ifconfig eth0 192.168.&lt;em&gt;###&lt;/em&gt;.&lt;em&gt;###&lt;/em&gt; netmask 255.255.255.0
route add default gw 192.168.&lt;em&gt;###&lt;/em&gt;.&lt;em&gt;###&lt;/em&gt;
echo "nameserver &lt;em&gt;###&lt;/em&gt;.&lt;em&gt;###&lt;/em&gt;.&lt;em&gt;###&lt;/em&gt;.&lt;em&gt;###&lt;/em&gt;" &gt; /etc/resolv.conf
echo "nameserver &lt;em&gt;###&lt;/em&gt;.&lt;em&gt;###&lt;/em&gt;.&lt;em&gt;###&lt;/em&gt;.&lt;em&gt;###&lt;/em&gt;" &gt;&gt; /etc/resolv.conf&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Exit and save with &lt;tt&gt;Ctrl+X&lt;/tt&gt; and &lt;tt&gt;y&lt;/tt&gt;&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Copy this new file to the hard drive or floppy to save it&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;$ cp /etc/rc.hd /hd&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Then run the script&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;$ sh /etc/rc.hd&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;And make sure the internet is actually working&lt;/p&gt;&lt;/div&gt;
&lt;div class="content"  style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;$ ping google.com&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;I had to change my pants when it worked the first time.&lt;/p&gt;&lt;/div&gt;
&lt;h4 id="_get_the_real_distro_dsl_8230_or_not"&gt;Get the real distro: DSL&amp;#8230;or not&lt;/h4&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;My first attempt at a distro was DSL. I followed their instructions for the &lt;a href="http://www.damnsmalllinux.org/wiki/index.php/Floppy_Only_Install_with_Netcard_(Poormans_Install)"&gt;&amp;#8220;Poorman&amp;#8217;s install&amp;#8221;&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Unfortunately BasicLinux doesn&amp;#8217;t have ash installed, so it can&amp;#8217;t run the frugal_lite.sh script. But looking at the script code, all it does is this:&lt;/p&gt;&lt;/div&gt;
&lt;div class="ulist"&gt;&lt;ul&gt;
&lt;li&gt;
download the current DSL iso
&lt;/li&gt;
&lt;li&gt;
mount it
&lt;/li&gt;
&lt;li&gt;
copy everything out of it, onto the harddisk
&lt;/li&gt;
&lt;li&gt;
download the floppy boot image
&lt;/li&gt;
&lt;li&gt;
dd the floppy image to a floppy
&lt;/li&gt;
&lt;li&gt;
reboot the computer
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;More unfortunately, I never could get BasicLinux to mount the iso.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Sooo&amp;#8230;on another computer, I had to take all the files out of iso and put them into a tar.gz, then run a quick web server with newlisp (&lt;tt&gt;newlisp -c -d 8080 -w&lt;/tt&gt;), so the lappy could &lt;tt&gt;wget&lt;/tt&gt; the file (there&amp;#8217;s gotta be a better way to do this).&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Finally I got all of the DSL iso files copied onto the lappy harddrive.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;I made a boot disk with dd from the ``bootfloppy.img'' file. Unfortunately the Toshiba didn't like the boot disk (&amp;#8220;Boot failed&amp;#8221;). After confirming that it just wasn&amp;#8217;t going to take that image, I instead tried bootfloppy-grub.img. I had to change my pants again when it actually did boot.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Unfortunately, neither of the two Grub options worked. So I had to manually tell it. Press &lt;tt&gt;'c'&lt;/tt&gt; for the prompt, and type these commands (from &lt;a href="http://www.damnsmalllinux.org/wiki/index.php/Installing_Grub"&gt;here&lt;/a&gt;)&lt;/p&gt;&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content" style="border: 1px solid silver; background: #f4f4f4; padding-left: 0.5em; word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;
&lt;pre&gt;&lt;tt&gt;root (hd0,0)
kernel /boot/isolinux/linux24 root=/dev/hda1
initrd /boot/isolinux/minirt24.gz
makeactive
boot&lt;/tt&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;(the command "&lt;tt&gt;title DSL&lt;/tt&gt;" just gave me an error)&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;One last pair of pants for when this thing actually started booting up&amp;#8230;and I had plenty of time to change because the bootup took forever.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;DSL saw I had PCMCIA, and even the network card, unfortunately it said it didn&amp;#8217;t have the drivers for any of it. Also my mouse wasn&amp;#8217;t working.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;At this point I give up on DSL because I didn&amp;#8217;t want to figure out how to install the drivers for my network card without having a network card to download them (I&amp;#8217;d have to find them on another computer and copy them onto a floppy?).&lt;/p&gt;&lt;/div&gt;
&lt;h4 id="_another_distro"&gt;Another distro?&lt;/h4&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;I thought I might also try &lt;a href="http://featherlinux.berlios.de/"&gt;Feather Linux&lt;/a&gt;. I have plenty of disk space, and this slightly bigger distro might have my network card drivers.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Boot without CD&lt;br /&gt;
&lt;a href="http://featherlinux.berlios.de/booting.html"&gt;http://featherlinux.berlios.de/booting.html&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Need to download the USB distro zip, and unpack to the drive. Make the boot floppy. Once booted, I should be able to install it.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Other link&lt;br /&gt;
&lt;a href="http://featherlinux.berlios.de/phpBB2/viewtopic.php?t=994"&gt;http://featherlinux.berlios.de/phpBB2/viewtopic.php?t=994&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;h4 id="_not_to_be_continued"&gt;Not to be continued&lt;/h4&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Got burned out with all this madness. If I ever resume trying to get Linux installed, I plan to just use BasicLinux-at least I know it works. Plus I found X detects the mouse so long as it&amp;#8217;s plugged in during bootup and never removed.&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Unfortunately BasicLinux doesn&amp;#8217;t come with gcc, so adding that would be the first priority.&lt;/p&gt;&lt;/div&gt;
&lt;h4 id="_miscellaneous"&gt;Miscellaneous&lt;/h4&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Linux PCMCIA Info&lt;br /&gt;
&lt;a href="http://pcmcia-cs.sourceforge.net/ftp/doc/PCMCIA-HOWTO-3.html"&gt;http://pcmcia-cs.sourceforge.net/ftp/doc/PCMCIA-HOWTO-3.html&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.linux.org/docs/ldp/howto/Ethernet-HOWTO-4.html"&gt;http://www.linux.org/docs/ldp/howto/Ethernet-HOWTO-4.html&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;Windows driver for the PCMCIA Ethernet card&lt;br /&gt;
&lt;a href="http://members.driverguide.com/driver/detail.php?driverid=31708"&gt;http://members.driverguide.com/driver/detail.php?driverid=31708&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-8337375835503337027?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/8337375835503337027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/installing-linux-on-toshiba-satellite.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8337375835503337027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8337375835503337027'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/installing-linux-on-toshiba-satellite.html' title='Installing Linux on a Toshiba Satellite T1960CS'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-8875969804867783105</id><published>2009-04-10T13:53:00.001-07:00</published><updated>2009-06-02T12:57:14.470-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>A fine transform</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Spent a day trying to figure out why this function worked&amp;#8230;&lt;/p&gt;&lt;/div&gt; &lt;div class="exampleblock" style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt; &lt;pre&gt;&lt;tt&gt;&lt;span style="color: #009900"&gt;void&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;transformDraw&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #008080"&gt;BufferedImage&lt;/span&gt; bi&lt;span style="color: #990000"&gt;,&lt;/span&gt;
                   &lt;span style="color: #008080"&gt;Stroke&lt;/span&gt; st&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #008080"&gt;Color&lt;/span&gt; c&lt;span style="color: #990000"&gt;,&lt;/span&gt;
                   &lt;span style="color: #008080"&gt;AffineTransform&lt;/span&gt; at&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #008080"&gt;Shape&lt;/span&gt; sh&lt;span style="color: #990000"&gt;)&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
    &lt;span style="color: #008080"&gt;Graphics2D&lt;/span&gt; g2d &lt;span style="color: #990000"&gt;=&lt;/span&gt; bi&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;createGraphics&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
    g2d&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;setStroke&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;st&lt;span style="color: #990000"&gt;);&lt;/span&gt;
    g2d&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;seteColor&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;c&lt;span style="color: #990000"&gt;);&lt;/span&gt;
    g2d&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;draw&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;at&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;createTransformedShape&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;sh&lt;span style="color: #990000"&gt;));&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;}&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;&amp;#8230;but this one&amp;#8230;&lt;/p&gt;&lt;/div&gt;
&lt;div class="exampleblock" style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="color: #009900"&gt;void&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;transformDraw&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #008080"&gt;BufferedImage&lt;/span&gt; bi&lt;span style="color: #990000"&gt;,&lt;/span&gt;
                   &lt;span style="color: #008080"&gt;Stroke&lt;/span&gt; st&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #008080"&gt;Color&lt;/span&gt; c&lt;span style="color: #990000"&gt;,&lt;/span&gt;
                   &lt;span style="color: #008080"&gt;AffineTransform&lt;/span&gt; at&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #008080"&gt;Shape&lt;/span&gt; sh&lt;span style="color: #990000"&gt;)&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;{&lt;/span&gt;
    &lt;span style="color: #008080"&gt;Graphics2D&lt;/span&gt; g2d &lt;span style="color: #990000"&gt;=&lt;/span&gt; bi&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;createGraphics&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;();&lt;/span&gt;
    g2d&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;setStroke&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;st&lt;span style="color: #990000"&gt;);&lt;/span&gt;
    g2d&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;seteColor&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;c&lt;span style="color: #990000"&gt;);&lt;/span&gt;
    g2d&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;transform&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;at&lt;span style="color: #990000"&gt;);&lt;/span&gt;
    g2d&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;draw&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;sh&lt;span style="color: #990000"&gt;);&lt;/span&gt;
&lt;span style="color: #FF0000"&gt;}&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;&amp;#8230;always resulted in the BufferedImage being filled entirely with the stroke color when I called the function like this&amp;#8230;&lt;/p&gt;&lt;/div&gt;
&lt;div class="exampleblock" style="word-wrap: normal; overflow-x: auto; overflow-y: hidden;"&gt;&lt;!-- Generator: GNU source-highlight 2.11.1
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite --&gt;
&lt;pre&gt;&lt;tt&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;transformDraw&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;myBufferedImg&lt;span style="color: #990000"&gt;,&lt;/span&gt;
              &lt;span style="font-weight: bold"&gt;&lt;span style="color: #0000FF"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;BasicStroke&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;3&lt;/span&gt;&lt;span style="color: #990000"&gt;),&lt;/span&gt; Color&lt;span style="color: #990000"&gt;.&lt;/span&gt;RED&lt;span style="color: #990000"&gt;,&lt;/span&gt;
              AffineTransform&lt;span style="color: #990000"&gt;.&lt;/span&gt;&lt;span style="font-weight: bold"&gt;&lt;span style="color: #000000"&gt;getScaleInstance&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #990000"&gt;(&lt;/span&gt;&lt;span style="color: #993399"&gt;100000&lt;/span&gt;&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #993399"&gt;100000&lt;/span&gt;&lt;span style="color: #990000"&gt;),&lt;/span&gt;
              myShape&lt;span style="color: #990000"&gt;);&lt;/span&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="paragraph"&gt;&lt;p&gt;It was &lt;a href="http://merganser.math.gvsu.edu/david/reed03/notes/chap4.pdf"&gt;this pdf&lt;/a&gt; that helped me finally understand why those two functions are different.&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-8875969804867783105?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/8875969804867783105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/fine-transform.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8875969804867783105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8875969804867783105'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/04/fine-transform.html' title='A fine transform'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-8379530443011449345</id><published>2009-03-02T23:26:00.000-08:00</published><updated>2009-03-02T23:30:07.033-08:00</updated><title type='text'>Clever RPG Puzzle?</title><content type='html'>&lt;img style="display:block; margin:0px auto 10px; text-align:center;width: 372px; height: 336px;" src="http://erictheturtlefiles.googlepages.com/20090302-GreaseMonster.png" border="0" alt="Grease Monster" /&gt;
Or terrible pun?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-8379530443011449345?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/8379530443011449345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/03/clever-rpg-puzzle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8379530443011449345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8379530443011449345'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/03/clever-rpg-puzzle.html' title='Clever RPG Puzzle?'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-8337149872020530194</id><published>2009-02-27T20:18:00.000-08:00</published><updated>2009-04-10T20:13:40.431-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='World of Warcraft'/><title type='text'>World of Warcraft's Poor Security</title><content type='html'>&lt;p&gt;By default, World of Warcraft fails to run properly under a limited account. The game will start and run fine, but no settings are saved (e.g. UI, setup, or addon changes) because everything is stored under the folder that WoW is installed (Program Files) which should be read-only. A reasonable work-around might be to make some of the subfolders under the WoW folder writable (such as WTF, Screenshots, etc.). &lt;/p&gt;  &lt;p&gt;A new failure of WoW security design was recently added with the game launcher. On every single run, the game launcher seems to randomly generate a brand-new exe at some random place on your computer. Firewalls are about as thrilled by this as I am. It defeats any kind of whitelist security, and a game has no business complicating computer security like that.&lt;/p&gt;  &lt;p&gt;&lt;a name="20090227-WoW"&gt;&lt;/a&gt;Additionally, there is an uncommon trick World of Warcraft uses that blocks other programs from inspecting its process in memory. This can also prevent other programs from forcefully shutting it down. The technique has to do with Window's Discretionary Access Control List (DACL). It is related to the security tab you see on Windows XP Professional that defines who has what access to various parts of your computer. &lt;/p&gt;  &lt;p&gt;A processes's security limitations can be changed dynamically during runtime by the process itself, and that's exactly what WoW does. A process changing it's own security at runtime is not particularly valuable because any other process with equal or greater security access can change it back. It's also meaningless when running as an administrator because every process automatically has all access to everything. &lt;/p&gt;  &lt;p&gt;None of this is new. People have known that WoW does for years now. I even ran across &lt;a href="http://www.edgeofnowhere.cc/viewtopic.php?p=2341937"&gt;a small bit of code&lt;/a&gt; specifically to adjust the security of WoW. I've &lt;a href="http://erictheturtlefiles.googlepages.com/20090227-WoW-dacl.c"&gt;updated it bit&lt;/a&gt; to simply remove WoW's security settings then exit. &lt;/p&gt;  &lt;p&gt;I'm new to this whole DACL business, so I might have missed some things. &lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;b&gt;Warning:&lt;/b&gt; Any use of this information, whether benign or malicious, might result in having your World of Warcraft account terminated. Take heed, lest you anger the Blizzard gods.&lt;/i&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-8337149872020530194?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/8337149872020530194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/world-of-warcrafts-poor-security.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8337149872020530194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/8337149872020530194'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/world-of-warcrafts-poor-security.html' title='World of Warcraft&amp;#39;s Poor Security'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-7723317833753705444</id><published>2009-02-22T23:22:00.000-08:00</published><updated>2009-06-28T19:56:38.751-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='World of Warcraft'/><title type='text'>Locking down my Windows XP machine</title><content type='html'>&lt;div id="preamble"&gt; &lt;div class="sectionbody"&gt; &lt;div class="paragraph"&gt;&lt;p&gt;During my last Windows XP re-install, I pondered for a moment if I should use proper computer security by running within a limited user account. Eventually my desire for convenience, and realization that I wield the raw power of the OS far too much, kept me with a default admin account.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;I&amp;#8217;ve never really needed much protection. I can count on one hand the number of viruses my antivirus has found on my computer this decade. Only one of those tricked me to execute it. Over time, my weekly antivirus false-positives caused me to disable the nightly scans.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;No, my fear of unwanted programs wasn&amp;#8217;t enough to drive me into putting a lock on that admin door. It turned out to be the fear of programs I do want that pushed me to the switch. It started with World Of Warcraft&amp;#8217;s Warden, and culminated with Mirror&amp;#8217;s Edge&amp;#8217;s SecuROM. Invasive DRM and rootkits concern me far more than any virus.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;But I&amp;#8217;m glad I didn&amp;#8217;t try to live in the limited account back then. It would not have lasted very long before I would be sick of always having to switch to an admin account whenever I wanted to burn a CD, change anything in the control panel, install anything, or modify system or program files. There is the "Run as&amp;#8230;" option, but that often leaves changes made to the account being "run as", instead of the current account.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;Luckily my Linux experiences in the last year taught me that you can have the best of both worlds with a program like sudo. My searches for something like that for Windows led me to 3 open source solutions.&lt;/p&gt;&lt;/div&gt; &lt;div class="ulist"&gt;&lt;ul&gt; &lt;li&gt; &lt;a href="http://sourceforge.net/projects/sudowin"&gt;&lt;strong&gt;SudoWin&lt;/strong&gt;&lt;/a&gt; (Sudo for Windows): This is &lt;a href="http://www.codinghorror.com/blog/archives/000891.html#comments"&gt;repeatedly recomenneded&lt;/a&gt; by readers of Atwood&amp;#8217;s Real Ultimate Programming Power blog. &lt;/li&gt; &lt;li&gt; &lt;a href="http://sudown.sourceforge.net/"&gt;&lt;strong&gt;suDown&lt;/strong&gt;&lt;/a&gt; (or sudoWn): Tried briefly before running across&amp;#8230; &lt;/li&gt; &lt;li&gt; &lt;a href="http://www.dedoimedo.com/computers/surun.html"&gt;&lt;strong&gt;SuRun&lt;/strong&gt;&lt;/a&gt;: Seems to be the new kid on the block. I have been using this one for several weeks now, and so far I love it. &lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;For better or for worse, I disabled having to actually enter a password. This was mainly due to my need for some programs to always run with admin access (especially at startup). For everything else, I get a nice popup that just needs an OK click, not much different from Vista&amp;#8217;s UAC. &lt;em&gt;&lt;strong&gt;Update 1&lt;/strong&gt;: The new v1.2.0.6 lets you skip password input for your white-listed apps if you want.&lt;/em&gt;&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt;: After using SuRun even longer now, I&amp;#8217;ve only found 2 problems with it: (1) When browsing explorer as administrator, any changes you make don&amp;#8217;t get reflected in the file browser (you have to manually refresh to see), and (2) It sometimes takes several seconds to open new Windows explorer windows. In general big delays have occurred for any kind of file system browsing, or low-level associated functions. For example, mounting/unmounting a TrueCrypt volume can take up to 10 seconds, and has even failed with a strange error on unmounting at times.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;&lt;strong&gt;Update 3&lt;/strong&gt;: Found an &lt;a href="http://forum.kay-bruns.de/thread/154"&gt;insightful thread&lt;/a&gt; where someone discussed with the SuRun creator about some aspects of the program.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;It&amp;#8217;s kinda comforting to see Process Explorer unable to view any details of admin processes. I know that Warden and SecuROM* will be hitting the same roadblock.&lt;/p&gt;&lt;/div&gt; &lt;div class="paragraph"&gt;&lt;p&gt;However I ran across something a little disturbing with World of Warcraft the other day. Process Explorer was unable to view details of the Wow.exe process, as if it was running as admin without my knowledge.&lt;/p&gt;&lt;/div&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_vrkdqnCR4Dk/SazkWcbQriI/AAAAAAAAAJg/-BcLamekcVs/s1600-h/20090222-WowPE.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5308869135001759266" style="display: block; margin: 0px auto 10px; width: 400px; cursor: hand; height: 163px; text-align: center" alt="" src="http://4.bp.blogspot.com/_vrkdqnCR4Dk/SazkWcbQriI/AAAAAAAAAJg/-BcLamekcVs/s400/20090222-WowPE.png" border="0" /&gt;&lt;/a&gt; &lt;div class="paragraph"&gt;&lt;p&gt;&lt;em&gt;&lt;a href="http://erictheturtle.blogspot.com/2009/02/world-of-warcrafts-poor-security.html#20090227-WoW"&gt;To be continued&amp;#8230;&lt;/a&gt; * I&amp;#8217;m aware that SecuROM has been known to install a service, thus always granting it admin access, but I&amp;#8217;ve kept a watchful eye on my services and haven&amp;#8217;t noticed anything yet.&lt;/em&gt;&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-7723317833753705444?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/7723317833753705444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/locking-down-my-windows-xp-machine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/7723317833753705444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/7723317833753705444'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/locking-down-my-windows-xp-machine.html' title='Locking down my Windows XP machine'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_vrkdqnCR4Dk/SazkWcbQriI/AAAAAAAAAJg/-BcLamekcVs/s72-c/20090222-WowPE.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-6558729093098144388</id><published>2009-02-15T22:26:00.001-08:00</published><updated>2009-04-10T20:24:22.427-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mirror&apos;s Edge'/><title type='text'>Faith Model Continued</title><content type='html'>&lt;p&gt;I spent several more hours examining the &lt;tt&gt;CH_Faith_Cinematic.upk&lt;/tt&gt; &lt;b&gt;posedAgain&lt;/b&gt; StaticMesh. First off, I discovered that my raw data exporter in UE3PackageViewer doesn't seem to work correctly (it cut off half of some of the data). Manually pulling out the data, I found several lists of structures: &lt;/p&gt;  &lt;p&gt;   &lt;div class="wlWriterEditableSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c5b69c45-ba17-40b6-9fe3-73eb24122e11" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color:#FFFFFF;overflow: auto;"&gt;&lt;span style="color: #0000FF;"&gt;struct&lt;/span&gt;&lt;span style="color: #000000;"&gt; UnknownStruct1 {
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;struct&lt;/span&gt;&lt;span style="color: #000000;"&gt; Vertex1 {
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt; x;
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt; y;
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt; z;
    };
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;struct&lt;/span&gt;&lt;span style="color: #000000;"&gt; Vertex2 {
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt; x;
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt; y;
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt; z;
    };
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; UnknownInt;  &lt;/span&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt; either 0 or 1 &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    union {
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;struct&lt;/span&gt;&lt;span style="color: #000000;"&gt; { &lt;/span&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt; when UnknownInt == 0 &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;short&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; UnknownStruct1Index;
            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;short&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; UnknownStruct1IndexPlus1;
        };
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;struct&lt;/span&gt;&lt;span style="color: #000000;"&gt; { &lt;/span&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt; when UnknownInt == 1 &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;short&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; Count;
            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;short&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; TriangleIndex;
        };
    };
};

&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;struct&lt;/span&gt;&lt;span style="color: #000000;"&gt; Triangle {
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;short&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; VertexIndexes[&lt;/span&gt;&lt;span style="color: #800080;"&gt;3&lt;/span&gt;&lt;span style="color: #000000;"&gt;];
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;short&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; UnknownShort; &lt;/span&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt; material number? &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
};

&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;struct&lt;/span&gt;&lt;span style="color: #000000;"&gt; Vertex {
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt; x;
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt; y;
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt; z;
};

&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;struct&lt;/span&gt;&lt;span style="color: #000000;"&gt; UnknownStruct2 {
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;char&lt;/span&gt;&lt;span style="color: #000000;"&gt; Unknown1[&lt;/span&gt;&lt;span style="color: #800080;"&gt;4&lt;/span&gt;&lt;span style="color: #000000;"&gt;];
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;char&lt;/span&gt;&lt;span style="color: #000000;"&gt; Unknown2[&lt;/span&gt;&lt;span style="color: #800080;"&gt;4&lt;/span&gt;&lt;span style="color: #000000;"&gt;];
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; NegOne; &lt;/span&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt; always -1 &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;char&lt;/span&gt;&lt;span style="color: #000000;"&gt; Unknown3[&lt;/span&gt;&lt;span style="color: #800080;"&gt;4&lt;/span&gt;&lt;span style="color: #000000;"&gt;];
};

&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;struct&lt;/span&gt;&lt;span style="color: #000000;"&gt; UnknownStruct3 {
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; UnknownInts[&lt;/span&gt;&lt;span style="color: #800080;"&gt;4&lt;/span&gt;&lt;span style="color: #000000;"&gt;];
};&lt;/span&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;There is also a large list of &lt;tt&gt;short&lt;/tt&gt;s and another of &lt;tt&gt;bool&lt;/tt&gt;s. &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_vrkdqnCR4Dk/SZkFJWuvzBI/AAAAAAAAAJA/cH15pGybHEM/s1600-h/20090215-MysteryVerts.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5303275694484081682" style="float: left; margin: 0px 10px 10px 0px; width: 114px; cursor: hand; height: 320px" alt="" src="http://4.bp.blogspot.com/_vrkdqnCR4Dk/SZkFJWuvzBI/AAAAAAAAAJA/cH15pGybHEM/s320/20090215-MysteryVerts.png" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The list of &lt;tt&gt;Vertex&lt;/tt&gt; and &lt;tt&gt;Triangle&lt;/tt&gt; work out to the model in my last post. Of the rest, the list of &lt;tt&gt;UnknownStruct1&lt;/tt&gt; is the most interesting. Those verts aren't normals or texture coordinates (nearly all are &amp;gt; 1.0). When visualized in space, they hover all around the Faith model. &lt;/p&gt;

&lt;p&gt;Additional searching about Unreal meshes led me back to the &lt;a href="http://darendash.home.comcast.net/~darendash/Converter.html"&gt;UnrealToX3D&lt;/a&gt; converter. The author wrote a nice white paper about converting the t3d format. &lt;/p&gt;

&lt;blockquote style="font-style: italic"&gt;
  &lt;p&gt;The real challenge was converting the texture coordinates. Unreal textures are described as tiling a plane in space coincident with the polygon on which they lie. &lt;/p&gt;

  &lt;p&gt;Each surface has a 3D vertex for U, another for V, and another for the texture normal (these are usually orthogonal). A pan value (in UV units) may also be supplied. This scheme allows for arbitrary scale, rotation, shear, and displacement of the texture without having to describe UV coordinates for each vertex on a polygon. To turn these various directionals into common UV coordinates, I find a transform that rotates the polygon from its arbitrary orientation onto the XY plane, and apply the same transform to the U and V texture components. I can now use the transformed U sand V component (which are now co-planar with the XY plane) to scale the texture. Using the pan components as offsets, I now use the polygon's coordinates (which are now all in the XY plane) to produce the UV coordinates.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Could those random points in space actually be 3D UV coordinates? I looked at the faces associated with the points, but the relation doesn't make any sense to me. &lt;/p&gt;

&lt;p&gt;I wrote an &lt;a href="http://erictheturtlefiles.googlepages.com/20090215-CH_Faith_Cinematic-Exporter.zip"&gt;exporter for this model and structures&lt;/a&gt; in Python if you want to look at the data yourself. &lt;/p&gt;

&lt;p&gt;Other searching led me to comments in forums that say you can convert StaticMesh to brush in UnrealEd, and then export it as OBJ. I tried poking around but haven't quite found how.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-6558729093098144388?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/6558729093098144388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/faith-model-continued_15.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/6558729093098144388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/6558729093098144388'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/faith-model-continued_15.html' title='Faith Model Continued'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_vrkdqnCR4Dk/SZkFJWuvzBI/AAAAAAAAAJA/cH15pGybHEM/s72-c/20090215-MysteryVerts.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-6352856414024038322</id><published>2009-02-07T22:21:00.000-08:00</published><updated>2009-04-26T21:21:55.397-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mirror&apos;s Edge'/><title type='text'>Unreal 3 Engine Model Extraction</title><content type='html'>&lt;p&gt;While there is a lot of &lt;a href="http://on-mirrors-edge.com/forums/viewtopic.php?id=2742"&gt;modding that may be possible with Mirror's Edge&lt;/a&gt;, my primary desire is to gain access to the various models of the game. &lt;!-- The Flash-style cutscenes between the chapters make Faith look like a freakin' monkey. I probably don't have the artistic talent, but I would like to try my hand at re-creating those cutscenes using the models already available in the game. Even if I can't do it, maybe someone else would if the models were accessible. --&gt; &lt;/p&gt;  &lt;p&gt;I have searched high and low, with at least 30 different queries thrown at Google, and several hours of scanning results, but &lt;i&gt;nothing&lt;/i&gt; has turned up. No one seems to have a way to extract models from the Unreal 3 Engine. Which suggests that this is the first time anyone has. &lt;/p&gt;  &lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://erictheturtlefiles.googlepages.com/20090206-FaithTris.png"&gt;&lt;img style="float: left; margin: 0px 10px 10px 0px; width: 212px; cursor: hand; height: 459px" alt="Faith Mesh" src="http://erictheturtlefiles.googlepages.com/20090206-FaithTris.png" border="0" /&gt;&lt;/a&gt;If someone has already found a way to extract models, then I'd be more than happy to be wrong. Thus far my mesh explorations have been hit and miss. This Faith StaticMesh resource (CH_Faith_Cinematic .posedAgain) has easily identifiable vertices and triangle indices, but I can't locate the texture coordinates. The resource right next to this mesh (posedAgain_Shaded) is even less clear. The data is tremendously random, with no obvious patterns. The S_M95 weapon StaticMesh appears to be the same. &lt;/p&gt;  &lt;p&gt;After several hours of dead-ends I grew frustrated, so I played Unreal Tournament 3 for the rest of the day :) I'll give it another go eventually, but I don't have much hope in the results. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; Gildor's &lt;a href="http://www.gildor.org/en/projects/umodel"&gt;Unreal Mesh Viewer&lt;/a&gt; has now been &lt;a href="http://www.gildor.org/node/55"&gt;updated&lt;/a&gt; to extract Mirror's Edge &lt;b&gt;SekeletalMesh&lt;/b&gt;es. These are different from StaticMeshes (like the one above), and they include the bone structure of the model as well. The Faith SkeletalMesh (the one you actually see running around in the game) is in CH_TKY_Crim_Fixer.upk as SK_TKY_Crim_Fixer.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-6352856414024038322?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/6352856414024038322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/unreal-3-engine-model-extraction.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/6352856414024038322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/6352856414024038322'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/unreal-3-engine-model-extraction.html' title='Unreal 3 Engine Model Extraction'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-5631738806231536525</id><published>2009-02-03T19:46:00.000-08:00</published><updated>2009-04-10T20:27:59.294-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DRM'/><title type='text'>In Capitalist America, DRM messes with YOU</title><content type='html'>&lt;p&gt;Suddenly had an itching to play Gears of War today for &lt;a href="http://torrentfreak.com/drm-jams-the-gears-of-war-090130/"&gt;no reason&lt;/a&gt;. &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_vrkdqnCR4Dk/SYkRq0HcBuI/AAAAAAAAAIw/Rju2XjH-YPg/s1600-h/20090203-GoW-DRM-fail.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5298785863820117730" style="display: block; margin: 0px auto 10px; width: 200px; cursor: hand; height: 38px; text-align: center" alt="You cannot run the game with modified executable code. Please reinstall the game." src="http://3.bp.blogspot.com/_vrkdqnCR4Dk/SYkRq0HcBuI/AAAAAAAAAIw/Rju2XjH-YPg/s200/20090203-GoW-DRM-fail.png" border="0" /&gt;&lt;/a&gt;Stupid #%^$@$## DRM. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Edit:&lt;/b&gt; Since the source of the problem is due to the unintentional expiration of the programs digital signature, which was used solely to prevent people from playing PVP with modified executables, there has been a ton of debate whether this is really DRM. &lt;/p&gt;  &lt;p&gt;I assume most people consider DRM the new lingo for 'copy protection' (which I think was a more accurate description). This interpretation of DRM obviously does not apply to the core problem above. But given what Digital Rights Management describes (it manages your right to use their data), then I'd say this is certainly DRM. I paid for the game, but I don't get to do whatever I want with it. &lt;/p&gt;  &lt;p&gt;On the plus side, maybe the patch they'll probably release will include at least a few other bug-fixes for this crap-tastically buggy game.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-5631738806231536525?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/5631738806231536525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/in-capitalist-america-drm-messes-with.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/5631738806231536525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/5631738806231536525'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/in-capitalist-america-drm-messes-with.html' title='In Capitalist America, DRM messes with YOU'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_vrkdqnCR4Dk/SYkRq0HcBuI/AAAAAAAAAIw/Rju2XjH-YPg/s72-c/20090203-GoW-DRM-fail.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-946256221379273660</id><published>2009-02-01T14:43:00.001-08:00</published><updated>2009-04-10T20:30:09.405-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DRM'/><category scheme='http://www.blogger.com/atom/ns#' term='SecuROM'/><title type='text'>Messin' with SecuROM</title><content type='html'>&lt;p&gt;&lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx"&gt;Process Monitor&lt;/a&gt; is one of the programs that SecuROM blacklists. If you try to start Mirror's Edge with Process Monitor running, you get a beautifully designed&lt;sup&gt;*&lt;/sup&gt;, and clearly explained&lt;sup&gt;*&lt;/sup&gt; dialog that looks like this. &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_vrkdqnCR4Dk/SYYlvAEJiDI/AAAAAAAAAIo/uqET2t4dwx0/s1600-h/20080201-DumbError.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5297963501049448498" style="display: block; margin: 0px auto 10px; width: 200px; cursor: hand; height: 92px; text-align: center" alt="A required security module cannot be activated. This program cannot be executed (5025)." src="http://2.bp.blogspot.com/_vrkdqnCR4Dk/SYYlvAEJiDI/AAAAAAAAAIo/uqET2t4dwx0/s200/20080201-DumbError.png" border="0" /&gt;&lt;/a&gt;* &lt;span style="font-size: 75%; font-style: italic"&gt;/sarcasm&lt;/span&gt; &lt;/p&gt;  &lt;p&gt;But it's not hard to run Process Monitor with Mirror's Edge. Login as an administrator and startup Process Monitor. Then switch users to a limited account and run the game. Having done this with Mirror's Edge, I can see it creates a dll in your Temp folder called drm_dyndata_#######.dll. The '#######' seems to always be the same number for me, but other people report a different number on their computers. If there is some kind of 'error' (i.e. they want to have more control over your computer than you do) and Mirror's Edge refuses to start, then it also creates a dll called drm_dialog.dll. &lt;/p&gt;  &lt;h4&gt;The Turtle's Blog Presents: Messin' with SecuROM&lt;/h4&gt;  &lt;p&gt;Just for fun, I set the security of my temp folder to WRITE-ONLY and started up Mirror's Edge. Well SecuROM sure didn't like that, and somehow concluded that my game is no longer registered, and began its phone home process. &lt;/p&gt;  &lt;p&gt;Next I went to the SecuROM registry folder and exported the entries, then deleted them from the registry. Starting up Mirror's Edge, I blocked its attempts to phone home for a new registration. I then restored those exported SecuROM registry entries, and thankfully SecuROM was appeased and my game ran fine again. Note that Mirror's Edge has to be separately activated for &lt;b&gt;every account on your computer&lt;/b&gt;. I tried importing these registry entries on another account, but SecuROM rejected it and tried phoning home. &lt;/p&gt;  &lt;p&gt;Mirror's Edge phone home process involves trying to connect first to EA (proxy.novafusion.ea.com), then Google (www.google.com) with three different IP addresses, and finally Microsoft (www.microsoft.com) with two different IP addresses. It gives no indication it is doing this, and if Mirror's Edge fails to make contact with any of its desired sites, it takes about &lt;b&gt;two minutes&lt;/b&gt; before finally reporting it needs internet connection. I'm sure there are some oblivious users out there that double-clicked that icon like crazy, and after seeing no response, concluded that there is something wrong with the game or their computer. &lt;/p&gt;  &lt;p&gt;I thought I would try being one of those oblivious users, and started Mirror's Edge on an unregistered account--then kept double-clicking the icon until my computer froze briefly and started beeping at me. I had some 15 MirrorsEdge.exe processes started and my CPU maxed. In a few seconds all but the original process closed, but still no indicator that MirrorsEdge.exe was really doing anything until the eventual message is displayed. &lt;/p&gt;  &lt;p&gt;When will these game studios learn that this is (one of the reasons) why people hate DRM--because it's implemented so very poorly. I submit that a big reason &lt;a href="http://en.wikipedia.org/wiki/Steam_(content_delivery)"&gt;Valve's Steam&lt;/a&gt; has finally been somewhat accepted is because they try to reduce the hassle as much as possible. But I'm sure the rantings on some no-name blog amounts to a hill of Circuit City stock in the eyes of Sony. &lt;/p&gt;  &lt;p&gt;Disclaimers: Don't try these sorts of things unless you know what you are doing, are willing to possibly lose one of your 5 registrations, and don't mind if your computer could crash beyond repair. I have a fully legal copy of Mirror's Edge, and was perfectly happy to support the developers that did such a great job on the game. I wish more people would do the same.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-946256221379273660?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/946256221379273660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/messin-with-securom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/946256221379273660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/946256221379273660'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/02/messin-with-securom.html' title='Messin&amp;#39; with SecuROM'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_vrkdqnCR4Dk/SYYlvAEJiDI/AAAAAAAAAIo/uqET2t4dwx0/s72-c/20080201-DumbError.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-1167574860556523463</id><published>2009-01-29T20:01:00.000-08:00</published><updated>2009-04-10T20:35:16.698-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='World of Warcraft'/><title type='text'>Stupid Dragon</title><content type='html'>&lt;p&gt;Ever since patch 3.0, a terribly annoying dragon resides in the World of Warcraft login screen. Every couple of minutes it lets loose an obnoxious roar. &lt;/p&gt;  &lt;p&gt;You are sure to always find at least &lt;a href="http://www.google.com/search?q=site:forums.worldofwarcraft.com+dragon+roar"&gt;one active thread&lt;/a&gt; in the WoW forums focusing on this terrible design flaw. But it astounds me that the replies are mostly to tell the poster to STFU, or suggest half-baked solutions to what is the real problem: a stupid dragon. For those of you that find the 'whiners' more annoying than the dragon, I recommend these macros you can play every time you run across one of those threads:&lt;/p&gt;  &lt;div class="wlWriterEditableSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:06ff1f7d-0f0c-497d-bd08-3b314d7f732e" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color:#FFFFFF;overflow: auto;"&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script PlaySoundFile(&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;Sound\\Ambience\\GlueScreen\\Wrath_Login_1.wav&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;)
&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script PlaySoundFile(&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;Sound\\Ambience\\GlueScreen\\Wrath_Login_2.wav&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;) 
&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script PlaySoundFile(&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;Sound\\Ambience\\GlueScreen\\Wrath_Login_3.wav&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;) 
&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script PlaySoundFile(&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;Sound\\Ambience\\GlueScreen\\Wrath_Login_4.wav&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;For those of you who would rather spend time getting rid of the roar, the fix turns out to be terrifically easy. &lt;/p&gt;

&lt;p&gt;Download &lt;a href="http://erictheturtlefiles.googlepages.com/patch-1.MPQ"&gt;this file&lt;/a&gt; and put it into your &lt;tt&gt;World Of Warcraft/Data&lt;/tt&gt; folder to shut the dragon up. &lt;/p&gt;

&lt;p&gt;How this works (I think): When WoW needs a resource (a sound, graphic, etc.) it checks the name indexes found in the various MPQ files. If two MPQ files contain the same named resource, it picks one of them (probably from the last file in alphabetical order). So this MPQ file essentially replaces those 4 sound resources above with empty sounds. &lt;/p&gt;

&lt;p&gt;Don't believe me? You can use &lt;a href="http://www.zezula.net/mpq.html"&gt;Ladik's MPQ Editor&lt;/a&gt; to take a look at the MPQ file. &lt;/p&gt;

&lt;p&gt;I cannot take credit for this hack. Someone in the WoW forums posted this fix in a thread I am now unable to find again.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-1167574860556523463?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/1167574860556523463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/01/stupid-dragon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/1167574860556523463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/1167574860556523463'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/01/stupid-dragon.html' title='Stupid Dragon'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6008043529821824003.post-934695460063436302</id><published>2009-01-28T22:14:00.000-08:00</published><updated>2009-04-10T20:36:44.736-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mirror&apos;s Edge'/><title type='text'>Dissecting Mirror's Edge</title><content type='html'>&lt;p&gt;I'm brand new to the inner workings of the Unreal Engine, but this is what I've found works for Mirror's Edge. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://on-mirrors-edge.com/forums/viewtopic.php?id=2742"&gt;Enabling the built-in Mirror's Edge editor!&lt;/a&gt;: Folks have gotten the real Unreal Editor mostly working for Mirror's Edge. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://masseffect.bioware.com/forums/viewtopic.html?topic=649603&amp;amp;forum=125"&gt;UE3PackageViewer&lt;/a&gt;: Hands down the nicest and completely open source package viewer found. I've already &lt;a href="http://erictheturtlefiles.googlepages.com/UE3PackageViewer-v0.5.1.4.zip"&gt;updated it to work with Mirror's Edge&lt;/a&gt;. It can preview DDS images (double-click the Texture2D in the detailed list), and even read compressed packages (.me1 files). I've also added Ogg extraction, and raw dump extraction for unknown data (somewhat broken). &lt;b&gt;WARNING:&lt;/b&gt; the program is still full of bugs (and I don't have much motivation to update it any more that I have). &lt;/p&gt;  &lt;p&gt;&lt;a href="http://forums.epicgames.com/showthread.php?t=597581"&gt;Upk Info&lt;/a&gt;: Not quite as extensive package viewer, and doesn't currently work with Mirror's Edge, but it's also open source. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.gildor.org/en/projects/umodel"&gt;Unreal Model Viewer&lt;/a&gt;: Soon to be open-sourced model viewer that works for many Unreal Engine games, including UT3 and Mirror's Edge (Gildor is the man). &lt;/p&gt;  &lt;p&gt;&lt;a href="http://ner.mine.nu/oggextract/"&gt;Oggextract&lt;/a&gt;: Another open-source tool that scans and extracts Ogg files from the packages. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.zenebo.com/word/tools/unreal-tournament-3-resource-package-explorer/"&gt;Another Ogg extractor&lt;/a&gt;: Closed source Ogg previewer and extractor. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://developer.nvidia.com/page/tools.html#CONTENT"&gt;NVidia's content creation tools&lt;/a&gt;: Includes DDS image viewers and converters. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.radgametools.com/bnkdown.htm"&gt;Bink RAD tools&lt;/a&gt;: To watch and convert all the videos of the game. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.deep-shadows.com/hax/3DRipperDX.htm"&gt;3D Ripper DX&lt;/a&gt;: Can capture models being rendered by DirectX 9 on Windows XP. &lt;/p&gt;  &lt;h4&gt;Documentation&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://wiki.beyondunreal.com/Category:Legacy_content"&gt;The Beyond Unreal Wiki&lt;/a&gt;: Documentation for practically every aspect of older (&amp;lt;= 2004) Unreal Engines. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://udn.epicgames.com/Three/UT3Mods.html"&gt;Mod Authoring for Unreal Tournament 3&lt;/a&gt;: Serious documentation is serious. &lt;/p&gt;  &lt;h4&gt;Other points of interest&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://sourceforge.net/projects/ushock/"&gt;UShock&lt;/a&gt;: Open source UT2004 level viewer. Doesn't work with Mirror's Edge, but maybe it could be updated to do so.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6008043529821824003-934695460063436302?l=erictheturtle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://erictheturtle.blogspot.com/feeds/934695460063436302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://erictheturtle.blogspot.com/2009/01/dissecting-mirrors-edge.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/934695460063436302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6008043529821824003/posts/default/934695460063436302'/><link rel='alternate' type='text/html' href='http://erictheturtle.blogspot.com/2009/01/dissecting-mirrors-edge.html' title='Dissecting Mirror&amp;#39;s Edge'/><author><name>m35</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
