Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gmethvin
Copy link
Member

No description provided.

public static class JPAApiProvider implements Provider<JPAApi> {
private final JPAApi jpaApi;

public JPAApiProvider(JPAConfig jpaConfig, JPAEntityManagerContext context, ApplicationLifecycle lifecycle) {
Copy link
Contributor

@schmitch schmitch Dec 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoudln't we annotate that header as well? I guess mima will complain then? But at least write a note on top of it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a comment there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By annotate you mean add it to mima exclusions?

I think this constructor is actually being re-added here so we can fix binary compatibility which was broken after we re-add DBApi dependency. In other words, instead of adding the new constructor to mima exclusions, @gmethvin is re-adding this constructor.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well what I meant is that we either tell it's deprecated (since it's not in master) or we also add the constructor to master by adding a note that it doesn't initalize the database and somebody needs to do it by itself (actually the second note should be there anyway)

Copy link
Member Author

@gmethvin gmethvin Dec 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency on DBApi is just a hack here because the constructor relies on global state, so we could add back the old constructor in master too. The dependency could be fulfilled in another way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to refactor how this works in master anyway. There is no direct reason why this needs a dependency on DBApi. It's quite possible to have an alternative implementation that doesn't use JNDI at all, in which case the DBApi dependency is confusing and unnecessary.

Usually the way I handle this is to have a component that wraps the global state and is aware of whether it's initialized. In this case we could just make a JNDI class that does this and is injected where it's needed.

@gmethvin gmethvin merged commit 1eb8566 into playframework:2.5.x Jan 2, 2017
@gmethvin gmethvin deleted the mima branch January 2, 2017 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants