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

What are the ways to use MongoTemplate optimized for performance?
Spring CRUD repository: is there findOneByMaxXYZColumn()?
Spring data jpa - modifying query before execution
spring data mongodb #Query with exclude option
springdata mongo repository method to return specific document property list
jdbctemplate using OracleLobHandler-> OutOfMemoryError during file retrieval of 180 MB size
Override findAll() Spring Data Gemfire Repo Queries
How do I get Spring Data REST 2.0 RC1 to work?
SpringData MongoDB Using projection
Using Greenplum with Spring
Spring Data with Mongo: Subdocument name as query parameter
Set the fetch size with Spring Data
SpringData and Querydsl generate not optimal query
Adding QueryDSL to STS
Spring Data JPA with a custom RepositoryFactory and Multiple EntityManagers
Lazy loading Spring Data JPA repositories

Categories

HOME
amazon-web-services
nam
extjs
powerbi
memory
list
seedstack
systemd
antd
foaf
hid
message-queue
adobe
vsts-build
portable-class-library
biztalk-2010
swift2
apache-kafka-connect
azure-mobile-services
google-search-console
siesta
lc3
migrate
phpstorm-2017.1
rangy
bundler
heap-dump
nest-api
hidden
adminlte
cmake-gui
unity-container
web-analytics
kaggle
conda
rxjs5
exchange-server-2010
fstar
running-object-table
uilocalnotification
points
gravity-forms-plugin
javax.persistence
es6-modules
epplus
cloudera-manager
bean-validation
pdfminer
wdk
landscape
cartopy
ng-repeat
selenide
spring-restcontroller
microkernel
python-jira
pyttsx
minikube
fluid-mac-app-engine
jqgrid-asp.net
virtual-memory
morphline
docker-ucp
ol3-google-maps
brightscript
head.js
entropy
deedle
perl-data-structures
ogg
xcode6.4
libharu
dcount
qtcpsocket
perforce-integrate
static-methods
android-syncadapter
myfaces
directx-9
netdatacontractserializer
jnlp
fantom
kefir.js
phpredis
android-audiomanager
tidyr
fiware-bosun
jolie
sunos
cakephp-2.2
inequality
lmax
xcode6.3.1
aho-corasick
jini
cidr
jchartfx
strcmp
illuminate-container
libxml-js
indesign-server
dibs
html-frames
mongo-jackson-mapper
cyrillic
office-app
email-verification
lynx
series-40
algol68
multidrop-bus
expression-web
nosetests
photo-management
digiflow
qcar-sdk
printqueue
pyjamas
suphp
formal-semantics
mongrel
ppc

Resources

Encrypt Message