-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Generation of Primary Key fails
PostPosted: Thu Jul 26, 2007 2:18 pm 
Newbie

Joined: Sat Jul 07, 2007 7:23 am
Posts: 3
Hi there,

I have a problem with the generation of primary keys:

I am using
    Oracle 9.2
    hibernate3 (3.2.4.sp1)
    JBOSS


I use the following xml-mapping code for generating the key
Code:
<id name="passwordId" type="java.lang.Long">
  <column name="PASSWORD_ID" precision="11" scale="0" />
    <generator class="increment" />
</id>

The generation of the next id works fine - and as the log says - and debuging show it will be set in the pojo before persisting the Object
Code:
2007-07-26 14:43:45,796 DEBUG [org.hibernate.type.LongType] binding '321' to parameter: 1

But a look into the database does not show the' 321' but a number like '00000000000000000000000123034'.

The property of the Pojo is defined as java.lang.Long and the attribute in the Database is defined as Number(11).

By the way the same behaviour can be recognized on using other generator classes too.
Surprisingly some other tables work well although the same definitions for pk-generation are set.

Thanks for help!![/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 27, 2007 9:50 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
Which SQL Type does your PK Column have?

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 27, 2007 9:56 am 
Newbie

Joined: Sat Jul 07, 2007 7:23 am
Posts: 3
the sql type is Number(11)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.