File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Primary key generated as 5000000000006877 when generator class used is native

 
Anvi Chavda
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have table named remitter with primary key column as remitterId. The last entry in the table was with the remitterId as 6988(approx). On generation of the new remitter from the application it starts entering the row with remitterId as 500000000006877, which is a long digit and so application throws NumberformatException. While digging more in to it I found that generator class is native.

I have two questions here:
1. Why all of sudden this behaviour aroused?
2. how can I add the entries in the table once again to normal four digit?

I mean do i have to restart the application server or should make any changes in the database?

I am using sybase database.

Regards
Achavda
 
Anantha Sharma
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should check your sequence generator (Oracle) or run DBCC on MS SQL / MySql servers to find out what is the next PK value.. the problem should be there as your generator class is set to native (meaning that the db will take care of the id assignment).

 
Anvi Chavda
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Anantha,

Can you give the solution for the Sybase database. I am able to trace the sysindexed table and when searched with the primaryKey (pkREMIITER) of Remitter table, found the following result
id = 2029218548
and status = 2050
Dont know what to do with these details. Will changing any of the columns in sysindexes table help ?
 
Anantha Sharma
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not sure about sybase, with MS SQL server we have the DBCC command which can reseed a auto increment field...

Sybase has the dbcc command but no the identity reset option in it... i'm sure there is a way to reset an auto increment field (just need to search the net for it).

sorry i couldn't be of much help...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic