Spring Data JPA entity with NO #ID/Primary Key - spring-data-jpa

I am using Spring Boot Data JPA. For few tables I don't need primary key.
How could I achieve that? Is it possible?

Related

Can I split data into 2 collections in Mongo DB and access the same in SpringBoot

I am using Mongo DB as Database for my springboot application.
I wanted to split the data into 2 collections -primary and auxillary just like how we do it in sql- priamary and secondary table.
Can i do the above and use them in my Springboot application??
Spring boot + Spring data mongo supports multiple collections out of the box.
Just create your POJOs and add the #Document annotation.
You can then define Repository classes (extends MongoRepository) that are then bound to each collection.
Use them to perform nearly any actions on the data.
If you want the data to be in multiple databases, that is also possible, just a bit more complicated.

Spring Boot: PostgreSQL Entity vs MongoDB Document

Say I have a Customer Entity whose data is stored in a postgreSQL database. It has a OneToMany relationship with a Post Entity.
What if I wanted to store the posts as Documents in a mongoDB database? What configuration would I have to change besides setting up the two databases connectivity? How would I maintain the OneToMany relationship? Would customer_id have to be a field in the post Document?

Is there any example of using Spring Reactive to read through all documents of an ElasticSearch index?

Is there any example of using Spring Reactive to read through all documents of an ElasticSearch index?
I want to avoid Reactive repository though.
If you have an entity Entity and have a ReactiveElasticsearchOperations autowired then
Flux<SearchHit<Entity>> flux = operations.search(Query.findAll(), Entity.class);
and just consume the flux.

Discriminator based multi-tenancy with Spring Data MongoDB

There is a shared database that has a discriminator field "customer_id" in each collection. That is an approach that was taken for multi-tenancy support.
What would be the recommended approaches on how to implement support of the discriminator field in the latest Spring Data MongoDB?
The most straightforward way I can see at this point is to set "customer_id" in the ThreadLocal per each request (The data is exposed via REST API) and then just pass to each Spring Data method
findByXxxAndCustomerId(x, ThreadLocal.getCustomerId())

#DbRef is not saving child object automatically in spring data mongodb

I am currently using GA release of Spring Data MongoDB framework and #DbRef is not saving child object automatically in spring data mongodb. Can you tell me how can i make it work?
Saving child objects is not built into Spring Data MongoDB so you have to do it manually or you can extend AbstractMongoEventListener as I described it in my article: Spring Data MongoDB cascade save on DBRef objects