Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Is it possible to change Database schema at runtime
Is it possible to change Database schema at runtime [message #1834927] Fri, 20 November 2020 19:58 Go to next message
Seydou Zakou is currently offline Seydou ZakouFriend
Messages: 44
Registered: May 2020
Member
Hi everybody,

I would like to know if it is possible to change the database schema to use at runtime (I mean before each queries running through SQL.xxxx methods) or if any one has an idea how can it be done ?

NB: I'm using postgres, so I said database schemas.

[Updated on: Fri, 20 November 2020 20:01]

Report message to a moderator

Re: Is it possible to change Database schema at runtime [message #1834928 is a reply to message #1834927] Fri, 20 November 2020 20:07 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 154
Registered: March 2010
Senior Member
The SQL.xxx methods are just a shorthand form of BEANS.get(ISqlService.class).xxx

You can certainly write a class that just splits off to two or more sql services at runtime. Maybe also based on a certain criteria or parameter.

for example:

@Bean
@Order(0)
public class MyHybridSqlService implements ISqlService{
...
  public ...select(){
     if(it_is_a_workday){
          return     BEANS.get(MyPostgresSqlServiceA.class).select....
     }
     else{
          return     BEANS.get(MyPostgresSqlServiceB.class).select....
     }
  }
}


Does this point into the right direction?
Re: Is it possible to change Database schema at runtime [message #1834951 is a reply to message #1834928] Sat, 21 November 2020 20:18 Go to previous message
Seydou Zakou is currently offline Seydou ZakouFriend
Messages: 44
Registered: May 2020
Member
Thank you Ivan,
I will investigate in this direction. If I understand, I will have to implement a PostgresSqlService for each schema I will use. Is this right ?
Previous Topic:Error after deploy on Tomcat
Next Topic:Our friend Andreas Hoegger passed away
Goto Forum:
  


Current Time: Thu Apr 25 13:38:54 GMT 2024

Powered by FUDForum. Page generated in 0.07934 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top