Different representation of UUID in Java Hibernate and SQL Server : <p>I am trying to map a <code>UUID</code> column in POJO to SQL Server table column using Hibernate.</p>

<p>The annotations are applied as follows:</p>

<pre><code>@Id
@GeneratedValue
@Column(name = "Id", columnDefinition = "uniqueidentifier") 
public UUID getId(){ ... }
</code></pre>

<p>However, it seems that there is some endianness problem between the Java Hibernate mapping and SQL server.</p>

<p>For example, in my Java app, I have ids represented as:</p>

<pre><code>4375CF8E-DEF5-43F6-92F3-074D34A4CE35
ADE3DAF8-A62B-4CE2-9D8C-B4E4A54E3DA1
</code></pre>

<p>whereas in SQL Server, these are represented as:</p>

<pre><code>8ECF7543-F5DE-F643-92F3-074D34A4CE35
F8DAE3AD-2BA6-E24C-9D8C-B4E4A54E3DA1
</code></pre>

<p>Is there any way to have same representation at both sides?</p>

<p>Please note that <code>uniqueidentifier</code> is used only to have a <code>uniqueidentifier</code> typed id in SQL server instead of type <code>binary</code>; the same problem exists when <code>uniqueidentifier</code> is removed from annotation (the problem can be observed by converting <code>binary</code> is to <code>uniqueidentifier</code>).</p>
