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 8455791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:22:31+00:00 2026-06-10T12:22:31+00:00

I work on a large modularized project with many maven modules, and dependency management

  • 0

I work on a large modularized project with many maven modules, and dependency management is quite complex.

In our core module, we have an entity BackOfficeUser with many attributes.
This entity is used in most of the applicative modules.


But one of my module XXX need to enhance the user with a collection of entities UserRule.

What i’d like to know is if it’s possible to subclass the core BackOfficeUser to create an XXXBackOfficeUser in my application, with a new relationship non owned by the entity, which doesn’t need a new column in the core db table of BackOfficeUser.

I know i can create a DAO and call rulesDAO.findByUser(BackOfficeUser user)
But i’d like to know if it’s possible to have instead XXXBackOfficeUser.getRules()

All that without modifying the core BackOfficeUser class which is used by a LOT of other modules, and which is not a MappedSuperClass or anything else but a regular hibernate entity.

  • 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-06-10T12:22:33+00:00Added an answer on June 10, 2026 at 12:22 pm

    It is not possible without modification of BackOfficeUser class, but is possible without modifying table where BackOfficeUser is persisted. Modification needed to the BackOffice class is:

    @Inheritance(strategy = InheritanceType.JOINED)
    

    With Hibernate this does not cause additional DTYPE column to be added to the root-table, because Hibernate support joined inheritance without discriminator column. Joined inheritance without discriminator is not portable, because specification does not require support for it. Consequence is that for defining actual type of BackOfficeUser, queries will always be joined to the new table.

    Implementation goes roughly as follows:

    //Existing BackOfficeUser, @Inheritance is added
    @Entity
    @Inheritance(strategy = InheritanceType.JOINED)
    public class BackOfficeUser {
        @Id private Integer id;
    }
    
    
    //New class that extends BackOfficeUser. Will have dedicated
    //table for added persistent attributes, shared attributes
    //are persisted to existing table "BackOfficeUser"
    @Entity
    public class XxxBackOfficeUser extends BackOfficeUser {
        private String someAttribute
    
        @ManyToMany (mappedBy = "xxxBackOfficeUsers")
        private List<Rule> rules;
    }
    
    //New entity class which does have relation to XxxBackOfficeUser
    @Entity
    public class Rule {
        @Id private Integer id;
    
        @ManyToMany
        private List<XxxBackOfficeUser> xxxBackOfficeUsers;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large work space which has many source files of C code.
I work on a large project where many functions are not used. I would
I have a fairly large work project that uses pygtk for the GUI and
In my experience I have only had 2 patterns work for large-scale desktop application
I work on a large C/C++ project and the code base is maintained in
In software companies I have seen it's really hard to work on very large
I work on a reasonably large project (well over 100K lines of code) and
I work on a pretty large rails project at work. Sometimes I need to
I work for a large organization that supports many different sites on a nation
I work for a large company that has adopted sharepoint. I have been tasked

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.