<?xml version="1.0" encoding="utf-8"?><!-- generator="b2evolution/6.9.7-stable" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Mr N - Latest Comments on java.util.UUID primary keys in hibernate</title>
		<link>https://www.bigsoft.co.uk/blog/?disp=comments</link>
		<atom:link rel="self" type="application/rss+xml" href="https://www.bigsoft.co.uk/blog/?tempskin=_rss2&#38;disp=comments&#38;p=79" />
		<description></description>
		<language>en-GB</language>
		<docs>http://backend.userland.com/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=6.9.7-stable"/>
		<ttl>60</ttl>
		<item>
			<title> brndnbg [Visitor] in response to: java.util.UUID primary keys in hibernate</title>
			<pubDate>Sun, 05 Feb 2012 14:19:36 +0000</pubDate>
			<dc:creator><span class="user anonymous" rel="bubbletip_comment_711">brndnbg</span> <span class="bUser-anonymous-tag">[Visitor]</span></dc:creator>
			<guid isPermaLink="false">c711@https://www.bigsoft.co.uk/</guid>
			<description>&lt;p&gt;Hi, thanks for the tutorial! In UuidUserType, method deepCopy, performance can be improved by changing:&lt;/p&gt;
&lt;p&gt;UUID.fromString (other.toString ()) ;&lt;/p&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;p&gt;newUUID(other.getMostSignificantBits(), other.getLeastSignificantBits());&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p>Hi, thanks for the tutorial! In UuidUserType, method deepCopy, performance can be improved by changing:</p>
<p>UUID.fromString (other.toString ()) ;</p>
<p>to</p>
<p>newUUID(other.getMostSignificantBits(), other.getLeastSignificantBits());</p>]]></content:encoded>
			<link>https://www.bigsoft.co.uk/blog/2008/11/01/java-util-uuid-primary-keys-in-hibernate#c711</link>
		</item>
		<item>
			<title> Steve [Visitor] in response to: java.util.UUID primary keys in hibernate</title>
			<pubDate>Wed, 02 Mar 2011 15:37:53 +0000</pubDate>
			<dc:creator><span class="user anonymous" rel="bubbletip_comment_494">Steve</span> <span class="bUser-anonymous-tag">[Visitor]</span></dc:creator>
			<guid isPermaLink="false">c494@https://www.bigsoft.co.uk/</guid>
			<description>&lt;p&gt;Have the same problem as Gian Paolo with my column type : Char(1)&lt;/p&gt;
&lt;p&gt;Anyone have a solution ?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p>Have the same problem as Gian Paolo with my column type : Char(1)</p>
<p>Anyone have a solution ?</p>
<p>Thanks</p>]]></content:encoded>
			<link>https://www.bigsoft.co.uk/blog/2008/11/01/java-util-uuid-primary-keys-in-hibernate#c494</link>
		</item>
		<item>
			<title>davidnewcomb [Member] in response to: java.util.UUID primary keys in hibernate</title>
			<pubDate>Thu, 21 Jan 2010 10:47:48 +0000</pubDate>
			<dc:creator><a href="https://www.bigsoft.co.uk/?disp=user&amp;user_ID=1" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_1"><span class="identity_link_username">davidnewcomb</span></a> <span class="bUser-member-tag">[Member]</span></dc:creator>
			<guid isPermaLink="false">c350@https://www.bigsoft.co.uk/</guid>
			<description>&lt;p&gt;deepCopy - I agree.&lt;/p&gt;
&lt;p&gt;serializable - UUID has a readObject() but no writeObject(). If you don&amp;#8217;t explicitly assemble them then you get an exception when talking to the database because the (automatic) serialisation done by Java becomes the actual bytes in memory of the UUID which are invalid unicode characters to put into the varchar column in the database. Possibly you could change your schema to be binary but then it makes debugging and reading the database more difficult.&lt;/p&gt;
&lt;p&gt;equals - I agree.&lt;/p&gt;
&lt;p&gt;hashcode - I agree.&lt;/p&gt;
&lt;p&gt;There is a UserType.isMutable() call on the interface so I suspect that a lot of the things you queried might be handled higher up in the hibernate code without calling into this UserType implementation.
My implementation is as much an example as anything else so from it you can work out all the things you need to do (and the way you need to do them) as if it was really a user defined class.&lt;br /&gt;&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p>deepCopy - I agree.</p>
<p>serializable - UUID has a readObject() but no writeObject(). If you don&#8217;t explicitly assemble them then you get an exception when talking to the database because the (automatic) serialisation done by Java becomes the actual bytes in memory of the UUID which are invalid unicode characters to put into the varchar column in the database. Possibly you could change your schema to be binary but then it makes debugging and reading the database more difficult.</p>
<p>equals - I agree.</p>
<p>hashcode - I agree.</p>
<p>There is a UserType.isMutable() call on the interface so I suspect that a lot of the things you queried might be handled higher up in the hibernate code without calling into this UserType implementation.
My implementation is as much an example as anything else so from it you can work out all the things you need to do (and the way you need to do them) as if it was really a user defined class.<br /></p>]]></content:encoded>
			<link>https://www.bigsoft.co.uk/blog/2008/11/01/java-util-uuid-primary-keys-in-hibernate#c350</link>
		</item>
		<item>
			<title> Jason Bennett [Visitor] in response to: java.util.UUID primary keys in hibernate</title>
			<pubDate>Thu, 21 Jan 2010 09:33:05 +0000</pubDate>
			<dc:creator><span class="user anonymous" rel="bubbletip_comment_349">Jason Bennett</span> <span class="bUser-anonymous-tag">[Visitor]</span></dc:creator>
			<guid isPermaLink="false">c349@https://www.bigsoft.co.uk/</guid>
			<description>&lt;p&gt;Thanks very much for your work on the UUID generator and user type. I was looking over to code to incorporate it into my project, and had a few questions about the user type implementation.&lt;/p&gt;
&lt;p&gt;In deepCopy, since the UUID is immutable, I don&amp;#8217;t believe you need to do any work - just return the value passed in.&lt;/p&gt;
&lt;p&gt;For assemble and disassemble and replace, since UUIDs are serializable, is there any need to convert to String?&lt;/p&gt;
&lt;p&gt;Under equals(), I don&amp;#8217;t believe you need to cast before calling equals. You should just be able to check == and then call .equals().&lt;/p&gt;
&lt;p&gt;Hashcode can probably just return hashcode(); I think the casting check is somewhat superfluous.&lt;/p&gt;
&lt;p&gt;If your understanding is different from mine, please let me know. I have some UserType experience, but not a ton.&lt;/p&gt;
&lt;p&gt;jason&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p>Thanks very much for your work on the UUID generator and user type. I was looking over to code to incorporate it into my project, and had a few questions about the user type implementation.</p>
<p>In deepCopy, since the UUID is immutable, I don&#8217;t believe you need to do any work - just return the value passed in.</p>
<p>For assemble and disassemble and replace, since UUIDs are serializable, is there any need to convert to String?</p>
<p>Under equals(), I don&#8217;t believe you need to cast before calling equals. You should just be able to check == and then call .equals().</p>
<p>Hashcode can probably just return hashcode(); I think the casting check is somewhat superfluous.</p>
<p>If your understanding is different from mine, please let me know. I have some UserType experience, but not a ton.</p>
<p>jason</p>]]></content:encoded>
			<link>https://www.bigsoft.co.uk/blog/2008/11/01/java-util-uuid-primary-keys-in-hibernate#c349</link>
		</item>
		<item>
			<title> Aaron [Visitor] in response to: java.util.UUID primary keys in hibernate</title>
			<pubDate>Tue, 10 Feb 2009 23:16:16 +0000</pubDate>
			<dc:creator><span class="user anonymous" rel="bubbletip_comment_240">Aaron</span> <span class="bUser-anonymous-tag">[Visitor]</span></dc:creator>
			<guid isPermaLink="false">c240@https://www.bigsoft.co.uk/</guid>
			<description>&lt;p&gt;Thanks for the tutorial. This is great information.&lt;/p&gt;
&lt;p&gt;I followed your instructions exactly and am getting the following error:&lt;/p&gt;
&lt;p&gt;Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: bsuuid, for columns: [org.hibernate.mapping.Column(id)]&lt;/p&gt;
&lt;p&gt;Any ideas? Thanks.&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p>Thanks for the tutorial. This is great information.</p>
<p>I followed your instructions exactly and am getting the following error:</p>
<p>Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: bsuuid, for columns: [org.hibernate.mapping.Column(id)]</p>
<p>Any ideas? Thanks.</p>]]></content:encoded>
			<link>https://www.bigsoft.co.uk/blog/2008/11/01/java-util-uuid-primary-keys-in-hibernate#c240</link>
		</item>
		<item>
			<title>davidnewcomb [Member] in response to: java.util.UUID primary keys in hibernate</title>
			<pubDate>Thu, 05 Feb 2009 16:14:09 +0000</pubDate>
			<dc:creator><a href="https://www.bigsoft.co.uk/?disp=user&amp;user_ID=1" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_1"><span class="identity_link_username">davidnewcomb</span></a> <span class="bUser-member-tag">[Member]</span></dc:creator>
			<guid isPermaLink="false">c237@https://www.bigsoft.co.uk/</guid>
			<description>&lt;p&gt;You must make sure that the foreign key you are linking to is also set to be a UUID.&lt;/p&gt;
&lt;p&gt;You are probably getting the exception because hibernate is trying to insert a record with no id, then trying to update it afterwards with a newly generated key.&lt;/p&gt;
&lt;p&gt;Without seeing your code it&amp;#8217;s difficult to tell.&lt;/p&gt;
&lt;p&gt;I remember getting this exception and used the Eclipse debugger to figure it out, then changed my configuration accordingly.&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p>You must make sure that the foreign key you are linking to is also set to be a UUID.</p>
<p>You are probably getting the exception because hibernate is trying to insert a record with no id, then trying to update it afterwards with a newly generated key.</p>
<p>Without seeing your code it&#8217;s difficult to tell.</p>
<p>I remember getting this exception and used the Eclipse debugger to figure it out, then changed my configuration accordingly.</p>]]></content:encoded>
			<link>https://www.bigsoft.co.uk/blog/2008/11/01/java-util-uuid-primary-keys-in-hibernate#c237</link>
		</item>
		<item>
			<title> Stephane [Visitor] in response to: java.util.UUID primary keys in hibernate</title>
			<pubDate>Thu, 05 Feb 2009 15:36:59 +0000</pubDate>
			<dc:creator><span class="user anonymous" rel="bubbletip_comment_236">Stephane</span> <span class="bUser-anonymous-tag">[Visitor]</span></dc:creator>
			<guid isPermaLink="false">c236@https://www.bigsoft.co.uk/</guid>
			<description>&lt;p&gt;Salut,
La solution que tu donnes correspond parfaitement à mon problème. Je l&amp;#8217;ai donc suivie scrupuleusement. Mais j&amp;#8217;ai une erreur qui est générée suite à l&amp;#8217;utilisation de l&amp;#8217;UUID:
[MrN: The solution you give fits to my problem. So I followed scrupulously. But I get an error that is generated as a result of using the UUID]&lt;/p&gt;
&lt;p&gt;org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.DataException: Could not execute JDBC batch update&lt;/p&gt;
&lt;p&gt;Quelqu&amp;#8217;un peut-il m&amp;#8217;aider ?
[MrN: Can anyone help me?]
Merci d&amp;#8217;avance&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p>Salut,
La solution que tu donnes correspond parfaitement à mon problème. Je l&#8217;ai donc suivie scrupuleusement. Mais j&#8217;ai une erreur qui est générée suite à l&#8217;utilisation de l&#8217;UUID:
[MrN: The solution you give fits to my problem. So I followed scrupulously. But I get an error that is generated as a result of using the UUID]</p>
<p>org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.DataException: Could not execute JDBC batch update</p>
<p>Quelqu&#8217;un peut-il m&#8217;aider ?
[MrN: Can anyone help me?]
Merci d&#8217;avance</p>]]></content:encoded>
			<link>https://www.bigsoft.co.uk/blog/2008/11/01/java-util-uuid-primary-keys-in-hibernate#c236</link>
		</item>
			</channel>
</rss>
