No. As comments say, you either use IDENTITY strategy (so its set by the datastore), or you set it yourself. You can't have both
set auto_incremented primary key explicitly while inserting the record in JDO
-
23-06-2022 - |
سؤال
Enity primary key is an auto_incrimented ID in JDO
@Persistent(primaryKey = "true", valueStrategy = IdGeneratorStrategy.IDENTITY)
@Column(name = "ID")
private Long id;
When I am inserting any record, it's primary key ID is being set implicitly as auto_incremented.
I have a requirement in which I want set this ID (PK) using setter(setId())
explicitly while inserting the record.
Can we do this?
المحلول
لا تنتمي إلى StackOverflow