<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>non-random ramble &#187; hibernate</title>
	<atom:link href="http://jimbarritt.com/non-random/category/code/hibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://jimbarritt.com/non-random</link>
	<description>adventures in code</description>
	<lastBuildDate>Tue, 20 Sep 2011 13:16:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Oracle Jdbc Driver 10.2.0.2.0 fails to render Euro (€) when db is set to WE8MSWIN1252 encoding</title>
		<link>http://jimbarritt.com/non-random/2010/11/08/oracle-jdbc-driver-10-2-0-2-0-fails-to-render-euro-e-when-db-is-set-to-we8mswin1252-encoding/</link>
		<comments>http://jimbarritt.com/non-random/2010/11/08/oracle-jdbc-driver-10-2-0-2-0-fails-to-render-euro-e-when-db-is-set-to-we8mswin1252-encoding/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 16:46:41 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/?p=741</guid>
		<description><![CDATA[We just spent a few glorious hours or so trawling the internet and writing old skool jdbc code, to discover this little beauty. Simply upgrade to 10.2.0.5 of the jdbc driver and it goes away. Thanks to this post http://efreedom.com/Question/1-377745/Oracle-JDBC-Euro-Character we discovered our problem. For the full details on the euro&#8230;. http://www.fileformat.info/info/unicode/char/20ac/index.htm And if your [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jimbarritt.com/non-random/wp-content/uploads/2010/11/euro_sign.png" rel="lightbox[741]"><img src="http://jimbarritt.com/non-random/wp-content/uploads/2010/11/euro_sign.png" alt="" title="euro_sign" width="100" height="100" class="aligncenter size-full wp-image-743" /></a></p>
<p>We just spent a few glorious hours or so trawling the internet and writing old skool jdbc code, to discover this little beauty. Simply upgrade to 10.2.0.5 of the jdbc driver and it goes away.</p>
<p>Thanks to this post http://efreedom.com/Question/1-377745/Oracle-JDBC-Euro-Character we discovered our problem.</p>
<p>For the full details on the euro&#8230;. </p>
<p>http://www.fileformat.info/info/unicode/char/20ac/index.htm</p>
<p>And if your really bored:</p>
<p>http://www.fileformat.info/info/unicode/char/1f47e/index.htm</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2010%2F11%2F08%2Foracle-jdbc-driver-10-2-0-2-0-fails-to-render-euro-e-when-db-is-set-to-we8mswin1252-encoding%2F&amp;title=Oracle%20Jdbc%20Driver%2010.2.0.2.0%20fails%20to%20render%20Euro%20%28%E2%82%AC%29%20when%20db%20is%20set%20to%20WE8MSWIN1252%20encoding"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2010/11/08/oracle-jdbc-driver-10-2-0-2-0-fails-to-render-euro-e-when-db-is-set-to-we8mswin1252-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate Proxy InstantiationException</title>
		<link>http://jimbarritt.com/non-random/2010/07/23/hibernate-proxy-instantiationexception/</link>
		<comments>http://jimbarritt.com/non-random/2010/07/23/hibernate-proxy-instantiationexception/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 13:39:31 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[hibernate]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/?p=602</guid>
		<description><![CDATA[Changing entities to be lazy loaded led me to the following problem: Thanks to Kristian I jumped straight to the problem. From the Hibernate docs: Cat has a no-argument constructor. All persistent classes must have a default constructor (which can be non-public) so that Hibernate can instantiate them using Constructor.newInstance(). It is recommended that you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jimbarritt.com/non-random/wp-content/uploads/2010/07/facade.jpg" rel="lightbox[602]"><img src="http://jimbarritt.com/non-random/wp-content/uploads/2010/07/facade.jpg" alt="" title="facade" width="500" height="375" class="aligncenter size-full wp-image-603" /></a></p>
<p>Changing entities to be lazy loaded led me to the following problem:</p>
<pre name='code' class='java:nogutter:nocontrols'>
@OneToMany(fetch = FetchType.LAZY)
</pre>
<pre name='code' class='java:nogutter:nocontrols'>
Caused by: org.hibernate.HibernateException: Javassist Enhancement failed: Thing
	at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:142)
	at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:72)
	at org.hibernate.tuple.entity.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:402)
	at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3483)
&#8230;.
Caused by: java.lang.InstantiationException: Thing_$$_javassist_38
	at java.lang.Class.newInstance0(Class.java:340)
	at java.lang.Class.newInstance(Class.java:308)
	at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:139)
</pre>
<p>Thanks to <a href="http://kristian-domagala.blogspot.com/2008/10/proxy-instantiation-problem-from.html">Kristian</a> I jumped straight to the problem. From the <a href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/persistent-classes.html#persistent-classes-pojo-constructor">Hibernate docs</a>:</p>
<blockquote><p>Cat has a no-argument constructor. All persistent classes must have a default constructor (which can be non-public) so that Hibernate can instantiate them using Constructor.newInstance(). It is recommended that you have a default constructor with <strong>at least</strong> package visibility for runtime proxy generation in Hibernate.</p></blockquote>
<p>This should probably read &#8220;It is essential&#8230;.&#8221;</p>
<p>Anyway now everything is real lazy so happy days.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2010%2F07%2F23%2Fhibernate-proxy-instantiationexception%2F&amp;title=Hibernate%20Proxy%20InstantiationException"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2010/07/23/hibernate-proxy-instantiationexception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Log4J settings for working with Hibernate</title>
		<link>http://jimbarritt.com/non-random/2010/07/23/log4j-settings-for-working-with-hibernate/</link>
		<comments>http://jimbarritt.com/non-random/2010/07/23/log4j-settings-for-working-with-hibernate/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 12:28:37 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[hibernate]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/?p=588</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://jimbarritt.com/non-random/wp-content/uploads/2010/07/hibernate.png" rel="lightbox[588]"><img src="http://jimbarritt.com/non-random/wp-content/uploads/2010/07/hibernate.png" alt="" title="hibernate" width="600" /></a><br />
<pre name='code' class='xml:nogutter:nocontrols'>
	<!--
		These  hibernate values are quite tuned to provide a clear output of SQL and what parameters are bound
		org.hibernate should be on WARN so you don't see loads or random stuff
		org.hibernate.jdbc.ConnectionManager on DEBUG to show open and closing of connections
		org.hibernate.SQL on DEBUG to see the actual SQL statements (also need to turn it on in HibernateSessionFactory (show_sql=true)
		org.hibernate.type on TRACE	so that you can see which parameters are bound to the statements
		Any custom type mappers should also be put on trace so that you see them binding (of course you need to add the logging statements yourself)
		Please be careful when checking in this file to not check in local changes for specific debugging purposes
	-->
	<logger name="org.hibernate">
  		<level value="warn"/>
	</logger>
	<logger name="org.hibernate.jdbc.ConnectionManager">
  		<level value="debug"/>
	</logger>
	<logger name="org.hibernate.SQL">
  		<level value="debug"/>
	</logger>
	<category name="org.hibernate.type">
<priority value="trace"/>
	</category>
</pre></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2010%2F07%2F23%2Flog4j-settings-for-working-with-hibernate%2F&amp;title=Log4J%20settings%20for%20working%20with%20Hibernate"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2010/07/23/log4j-settings-for-working-with-hibernate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate components and relationships</title>
		<link>http://jimbarritt.com/non-random/2008/09/29/hibernat-components-and-relationships/</link>
		<comments>http://jimbarritt.com/non-random/2008/09/29/hibernat-components-and-relationships/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 15:16:32 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[hibernate]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/2008/09/29/hibernat-components-and-relationships/</guid>
		<description><![CDATA[Situation: you have a hibernate component which itself has a link to another object (e.g. many-to-one) When loading, if hibernate is not able to satisfy the dependency, it will NOT set the field for your component. e.g. we have :]]></description>
			<content:encoded><![CDATA[<p>Situation: you have a hibernate component which itself has a link to another object (e.g. many-to-one) </p>
<p>When loading, if hibernate is not able to satisfy the dependency, it will NOT set the field for your component.</p>
<p>e.g. we have :</p>
<pre style="overflow:hidden;">
<code>
<subclass name="DraftContentPage" discriminator-value="Content" lazy="false">
    <component name="contentPage" class="ContentPage" >
        <many-to-one name="coreContent"
                            column="core_content_id"
                            unique="true"
                            not-null="false"
                            class="com.gu.r2.common.model.content.DraftContent"
                            cascade="save-update,merge"/>
    </component>
</subclass>
</code>
</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2008%2F09%2F29%2Fhibernat-components-and-relationships%2F&amp;title=Hibernate%20components%20and%20relationships"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2008/09/29/hibernat-components-and-relationships/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

