Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 310815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:52:05+00:00 2026-05-12T07:52:05+00:00

I use JPA persistence for my data models with Eclipselink as the persistence provider.

  • 0

I use JPA persistence for my data models with Eclipselink as the persistence provider. I have a modular (OSGi) application and one of the modules contains the standard data model and a persistence unit that automatically includes all the entities from the package. The persistence provider is in another module, which works well.

Now I want a third module to add some entities to the persistence unit. How do I do that? I found this solution, which seems specific to Spring which I’m not using. The summary of that approach is to write a post processor that hooks into the persistence unit processing and manually merges <class> entries from the persistence.xml files.

Is it possible to merge persistence units? Can anybody suggest a workaround?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:52:05+00:00Added an answer on May 12, 2026 at 7:52 am

    First, here is a link on Dynamic-JPA they offer a way to update entities dynamically. I would explore this option first.


    Here is another link (PDF) from OSGi there are a few top level diagrams dealing with persistence and the EntityManagerFactory that may be useful.


    an interesting approach but may be unrelated

    Here is a link on creating persistence units programmaticly without using a persistence.xml file (which you can’t really do, but the answers offer some insight to the problem). philk offers a suggestion on how to remove the provider from the persistence.xml file. If you follow this method, you may be able to combine your entities into a specific persistence unit.

    “Well in the good old days of Hibernate I could just create a session and
    add my classes to it on the fly. Seems that never made it into SUNs JPA
    specs. However I have completely removed the provider from the
    persistence.xml and hand it to EL using the properties of the EMF. This
    seems to work ok. The only thing left in the persistence.xml is the spec
    of the classes. I guess it would not be too hard to expose the method
    that parses the classname in EL and creates the ClassDescriptor for it
    as a public method of the EL JPA Provider. “


    Finally, we come to the hackish solution, doing has already been suggested, simply edit your persistence.xml files after the fact. I believe this would work (although, I haven’t tried it) but it is definitely an option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 184k
  • Answers 184k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Discrimination must be between MyClass and MyOtherClass, not in the… May 12, 2026 at 4:50 pm
  • Editorial Team
    Editorial Team added an answer Just a little tip, in order to convert your received… May 12, 2026 at 4:50 pm
  • Editorial Team
    Editorial Team added an answer From my experience, web service interoperability isn't the magic it… May 12, 2026 at 4:50 pm

Related Questions

today I have coded a test case for my application, to see how transactions
I'm looking for an easy way to extend existing JPA mapping. The idea is
I am basically a newbie whose starting work on a new webapp. The webapp
I am trying to create an Eclipse application that uses JPA for persistence. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.