1

The current configuration of JDO metadata we have all the clases like this:

    <class name="ObjectOne" identity-type="datastore" table="ObjectOne" requires-extent="true" detachable="false">
              <datastore-identity column="JDOID" strategy="native" >
                  </datastore-identity > 
</class>
    <class name="ObjectTwo" identity-type="datastore" table="ObjectTwo" requires-extent="true" detachable="false">
              <datastore-identity column="JDOID" strategy="native" >
                  </datastore-identity > 
</class>

But right the problem is this that the JDOID or the Id of the object is not sequencial. Example:

Object 1 JDOID  |  Object 2 JDOID
             1                  3
             2
             4

Like you see this is a Big Issue because the ID is the number of produced Object. But now I need to migrate this to a different datastore-identity strategy. I'm using auto-assign strategy and everything works in new tables like for Object 3 is generating from 1. But changing the strategy in ObjectOne and ObjectTwo is giving me that the id can't not be null. Any suggestions giving in this problem?

Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
Gatusko
  • 2,503
  • 1
  • 17
  • 25
  • what is the relation between these classes? post the classes. What is "auto-assign" strategy? JDO has "identity", "native", "increment", "uuid-string", "uuid-hex" – Neil Stockton Sep 22 '16 at 08:10
  • Kodo has the strategy autoassign and this classes doesn't hava a relation. In Kodo documentation `autoassign: The database automatically assigns a primary key value on insert. This might be accomplished with an auto-increment column or with database triggers.` `And Kodo only supports: the native, sequence, autoassign, and identity datastore identity strategies` – Gatusko Sep 22 '16 at 12:52
  • That is JDO standard "IDENTITY" strategy you refer to; there is no such auto-assign. If using Kodo then untag DataNucleus – Neil Stockton Sep 22 '16 at 13:20
  • if you want to avoid already present values in the AUTO_INCREMENT column then update the AUTO_INCREMENT specification in your RDBMS to start at some point. – Neil Stockton Sep 22 '16 at 13:37
  • Well in the end I think I need to do a big migration because when a table is created via Kodo with jdo it doesn't create an Identity. Because we are using SQL server and you cannot add IDENTITY to an existing column. Thanks for the suggestion. – Gatusko Sep 22 '16 at 20:48

0 Answers0