This is all Hibernate Generated:

    create table MyObject (
        id integer not null,
        UUID uuid,
        primary key (id)
    )

    insert
    into
        MyObject
        (id, UUID)
    values
        (?, ?)

Here is what Hibernate is Binding:

commonObjects.MyObject{id=0, UUID=2ac27d72-
ea0f-46ef-8c96-29e728d4aaa1}

On Nov 19, 10:20 am, Max Bridgewater <[email protected]>
wrote:
> Out of curiosity, can you show you SQL statement for creating the table and
> for insertion?
>
> On Thu, Nov 19, 2009 at 11:07 AM, jgrasper <[email protected]>wrote:
>
> > I have been trying to use Hibernate and H2s capability of using
> > java.util.UUID.  The problem is that no matter what I have the UUID
> > field of my object set to, the UUID ends up in the db as:
>
> > aced0005-7372-000e-6a61-76612e757469
>
> > Is this value hard coded somewhere?  I get exceptions like this even
> > when I print out the UUID to the console on the Java Side and it is
> > different then the previous:
>
> > org.h2.jdbc.JdbcSQLException: Unique index or primary key violation:
> > PRIMARY_KEY_7  ON PUBLIC.MYOBJECT(UUID) [23001-106]
> >        at org.h2.message.Message.getSQLException(Message.java:103)
> >        at org.h2.message.Message.getSQLException(Message.java:114)
> >        at org.h2.message.Message.getSQLException(Message.java:77)
> >        at org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:
> > 160)
> >        at org.h2.index.BtreeLeaf.add(BtreeLeaf.java:67)
> >        at org.h2.index.BtreeIndex.add(BtreeIndex.java:223)
> >        at org.h2.table.TableData.addRow(TableData.java:117)
> >        at org.h2.command.dml.Insert.update(Insert.java:96)
> >        at org.h2.command.CommandContainer.update(CommandContainer.java:71)
> >        at org.h2.command.Command.executeUpdate(Command.java:207)
> >        at org.h2.server.TcpServerThread.process(TcpServerThread.java:297)
> >        at org.h2.server.TcpServerThread.run(TcpServerThread.java:136)
> >        at java.lang.Thread.run(Unknown Source)
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "H2 Database" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<h2-database%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/h2-database?hl=.

--

You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=.


Reply via email to