Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EbeanPlugin: Add support for read-only data-sources #118

Open
wsargent opened this issue Jun 20, 2017 · 1 comment
Open

EbeanPlugin: Add support for read-only data-sources #118

wsargent opened this issue Jun 20, 2017 · 1 comment

Comments

@wsargent
Copy link
Member

Originally from playframework/playframework#3237

Currently (Play 2.2, Play 2.3) when using multiple data-sources then it is not possible to disable evolutions and DDL automatic generation. This is usually not a problem, but becomes a problem with at least one of the sources being read-only.

There is a PR for disabling evolutions for specific data-sources, but there is no way to disable DDL generation per data-source. Only way is to disable EbeanPlugin DDL generation globally like this:

evolutionplugin=disabled
This does not solve the problem, because we want evolutions for non-read-only datasources.

Currently, when evolutionplugin is enabled (the default behavior) then evolution scripts are generated automatically by using DDL extraction here. The scripts are created and created and since this is a read-only datasource then they cannot be applied.

There should be a data-source specific option to disable automatic DDL generation.

PS! The option name evolutionplugin is also misleading for this particular use-case.

@tamanugi
Copy link

tamanugi commented Jan 15, 2019

Any progress on this issue?

I got error

Error trying to create the default EbeanServer
java.lang.RuntimeException: DataSource user is null?
	at org.avaje.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:207)
	at org.avaje.datasource.core.Factory.createPool(Factory.java:15)
	at io.ebeaninternal.server.core.DefaultContainer.getDataSourceFromConfig(DefaultContainer.java:334)
	at io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:278)
	at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:117)
	at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:88)
	at io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:45)
	at io.ebean.EbeanServerFactory.create(EbeanServerFactory.java:58)
	at io.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:202)
	at io.ebean.Ebean$ServerManager.<init>(Ebean.java:160)
	at io.ebean.Ebean$ServerManager.<init>(Ebean.java:133)
	at io.ebean.Ebean.<clinit>(Ebean.java:127)
package models;

import io.ebean.config.ServerConfig;
import io.ebean.event.ServerConfigStartup;
import org.avaje.datasource.DataSourceConfig;

public class MyServerConfigStartup implements ServerConfigStartup {

    @Override
    public void onStart(ServerConfig serverConfig) {
            serverConfig.setAutoReadOnlyDataSource(true);
        }
    }
}

Is there a workaround or correct setting?

ref: ebean-orm/ebean#1232


Java: 1.8.0_152
Play: 2.6.13
Play-Ebean: 4.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants