spring-data


Spring Gemfire entity class id generation


Is it possible to use auto generated id in Spring Data Gemfire?
for example, if I have a class called MyGemfire
#region("myregion")
class MyGemfire{
#Id
#generatedValue????// if it is not possible what method I have to use to generate id in auto increment fashion?
Long id;
String name;
...
}
From a quick look at SimpleGemfireRepository it doesn't look like the repository is generating an ID:
#Override
public <U extends T> U save(U entity) {
ID id = entityInformation.getId(entity).orElseThrow(
() -> newIllegalArgumentException("ID for entity [%s] is required", entity));
template.put(id, entity);
return entity;
}
Also, this question and its answer suggest there is no ID generation in Gemfire itself.
So what you should do is to create your ID yourself. For example, it should be possible to have two constructors one taking an ID and the othe not taking an ID but generating it. A UUID would be the obvious choice. If you are bound to Long values, you probably have to roll your own algorithm.
To make it obvious to Spring Data which constructor to use when loading instances, you can use the #PersistenceConstructor annotation.

Related Links

Spring Data JPA “OR” with single parameter
What is the need of EntityManager in Spring data jpa
Sort by given formula (Haversine) with Query DSL
QuerydslPredicate and generic class
NOAUTH Authentication required when connecting to Redis Sentinel with LettuceConnectionFactory
Spring-Batch - Long running TaskletStep issue
Couchbase - Value Eviction to Full Evictionchange huge data base
Connection leakage issue when static method called from spring transactional method
Adding a resource to a collection using spring-data-rest
Spring-data-neo4j v4, why no index
Use of Domain Objects in Spring Integration
int-jpa:retrieving-outbound-gateway and caching the result
why do we need add annotation #Transactional in springdata for update function?
Couchbase BulkGet in spring data couchbase
Saving an Iterable of a Spring Data Cassandra entity yields exception
Can i return a Stream from a spring jpa repository using a querydsl predicate argument

Categories

HOME
webview
ontouchlistener
xcode8.1
applescript
vsts-build
google-webmaster-tools
gallery
share
siesta
fireloop
alljoyn
watch-os-3
vimeo
outlook-restapi
stimulsoft
cuba-platform
synthesis
jaspersoft-studio
string-formatting
gmp
amazon-mws
angular2-highcharts
node-webkit
gitkraken
stackexchange.redis
acl
mod-wsgi
opentext
raima
web-config-transform
list-comprehension
cube
sparkle
substance
instructions
osx-lion
om-next
pdfnet
stackpanel
code-rally
right-click
uipickerview
newtons-method
hdiv
raytracing
robust
contactless-smartcard
sendinput
moinmoin
ipp-protocol
libreoffice-writer
password-hash
solr-query-syntax
iptv
palindrome
wikimapia
adobe-reader
boost-compute
bilinear-interpolation
svnserve
mathnet
i2b2
wikimedia-commons
wepay
helm
ruby-on-rails-4.1
jnlp
postal-code
bootstrap-wysiwyg
wicked-gem
webproject
kotlin-android-extensions
subfolder
android-audiomanager
signed
nhibernate-criteria
iodocs
accessory
jini
neo4jphp
profiles
application-blocks
smips
sensormanager
strcmp
vlab
blobstorage
proc-open
user-forums
live-wallpaper
system-information
glx
zend-server-ce
differentiation
datacontracts
cewolf
tablet-pc
dip
channelfactory
regression-testing
git-log
bass
projectpier
processors
fxruby
external-sorting
regioninfo
rootkit

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App