Skip to main content



      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 14:58 Go to next message
Eclipse UserFriend
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 15:01] by Moderator

Re: Is it possible to change Database schema at runtime [message #1834928 is a reply to message #1834927] Fri, 20 November 2020 15:07 Go to previous messageGo to next message
Eclipse UserFriend
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 15:18 Go to previous message
Eclipse UserFriend
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: Sun Jul 13 14:10:43 EDT 2025

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

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

Back to the top