dipaksavaliya / datanucleus-appengine

Automatically exported from code.google.com/p/datanucleus-appengine
0 stars 0 forks source link

Support Sequences on pks of type Key #115

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public static class HasSequenceWithUnencodedStringPk {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.SEQUENCE)
    private Key id;
  }

Requires a DataNuc change.

Original issue reported on code.google.com by max.r...@gmail.com on 14 Aug 2009 at 6:15

GoogleCodeExporter commented 8 years ago
Not sure how to do this, might not be possible.

Original comment by max.r...@gmail.com on 22 Aug 2009 at 6:28

GoogleCodeExporter commented 8 years ago
A value generator has no knowledge of what object the id is created for, and to 
generate a Key would likely need to know the parent key too. That situation 
would be impossible. The only situation that would be possible is where you 
have an object that is not "owned", in which case just change SequenceGenerator 
to use "field-name" property to detect the type of the field being generated 
for, and if Key then create a Key using the generated long value.

Original comment by googleco...@yahoo.co.uk on 29 Feb 2012 at 1:34