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

  • SEARCH
  • Home
  • 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 8793823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:10:19+00:00 2026-06-13T23:10:19+00:00

Is it considered bad to create a hierarchy of interfaces in Java? I have

  • 0

Is it considered bad to create a hierarchy of interfaces in Java?

I have designed my repository layer like this:

  • Repository, contains CRUD methods
  • JPARepository, potential methods that is only needed in JPA
  • SomeModelRepository, specific methods for the repository of that model.
  • SomeModelJPARepository, extends JPARepository AND SomeModelRepository

Is this considered bad practice, and is it a strange organized hierarchy?

  • 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-13T23:10:20+00:00Added an answer on June 13, 2026 at 11:10 pm

    No, in fact it’s fairly common to create interface hierarchies, at least in libraries.
    Take NavigableSet for instance, which has 4 layers of interfaces above it (SortedSet, Set, Collection, Iterable).

    In this example, the diamond inheritance is a bit peculiar, but if necessary not a bad choice per se. But usually a tree hierarchy is much clearer and better. In this case I would consider making either:

    1. SomeModelRepository a subclass of JPARepository, thus forcing all implementing classes to support JPA
    2. Specifying the JPA support in a different interface, not a subclass from Repository. Then all classes could choose whether to implement JPA independent of their specific Repository interface. See Serializable for an example. This is the de facto solution for signalling that a class supports a specific feature like “serialization”, or maybe “persistence” like in this case.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C, it is considered bad practice to call strlen like this: for (
I have often heard that using break s in Java is considered bad practice,
I'm wondering if writing functions like this is considered good or bad form. def
I have created a table like this: CREATE TABLE #TEMP(RecordDate datetime, First VARCHAR(255), Last
Is it considered bad practice to have multiple try's in one method and structure
Is it considered bad practice to have multiple views for same URL in MVC,
Is using an instance of a class to access static methods considered bad practice?
In Java classes is it considered good or bad practice to access member fields
I think it's considered a bad practice to have controls appearing and disappearing and
Is line number 3 in my create action considered bad practice? Because a user

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.