For example, a user table with user information
user_0, user_1, user_2, user_3 (when userId is divided by 4, the remainder follows the table name)
I would like to know how to implement without having to implement multiple entities and repositories for as many tables as possible.
In the worst case scenario, I am trying to dynamically change the repository used in the service layer, but I do not want to implement multiple similar entities and repositories.
Thank you for your cooperation.
mysql spring spring-boot database jpa
As for the approach from DB, I think there is a way to prepare a UNION
VIEW if the table has the same structure.In other words, if you create a VIEW user
like the following, one entity and one repository will be enough.
CREATE VIEW user as(
select * from user_0
union
select * from user_1
union
select* from user_2
union
select * from user_3
);
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
578 Understanding How to Configure Google API Key
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.