0

I want split my RAP application into separate bundles.

First bundle - is main module. It contains common functions as navigation menu, opening database connection. (database oracle)

Other bundles is plugins modules, which contains views, jpa-entities, business-logic.

I need one database connection per application, per user, but I need jpa-entities in separate bundles and in main module. I don't need database connection per each plugin.

All plugins may work with main-module-entities.

Only plugin may work with self-plugin-module-entities.

Main module don't knows about entities in plugins.

Is it possible? Which framework can help me?

Sorry for my english :-)

1 Answers1

1

It is possible to have the entity classes in separate bundles, but:

  • you must have a persistence.xml file where all entity classes are listed
  • the bundle that contains the persistence-unit must import the packages where the entity classes are located

In short: You can have entity classes in separate modules, but you must have a main place where you collect all the information for the PU.

If I understand your question well, you want to have a main module that contains the PU but does not know about the entity classes. Sorry, it is not possible.

Alternative:

We had similar requirements so we decided to leave JPA and switch to Liquibase and QueryDSL2 combination. Liquibase is used to define the database schema and QueryDSL is used to construct the database independent SQL typesafe statements. With JPA words: No entity classes but only static-metamodel.

We also developed some modules and a maven plugin to support these technologies. It is undocumented yet but if you are interested in this technology stack, I can provide more details.

Balazs Zsoldos
  • 6,036
  • 2
  • 23
  • 31