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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:00:26+00:00 2026-05-12T08:00:26+00:00

I have a requirement to create a component which can be used stand-alone or

  • 0

I have a requirement to create a component which can be used stand-alone or within a larger application. When used stand-alone, it should not require a database, nor any database/ORM related dependencies. When used as as part of a larger app, some of the classes will indeed be persisted to a database via JPA/Hibernate.

I was thinking the domain objects in the component would not have any annotations (due to the requirement to not have any ORM-related dependencies). In the larger app, I would then sub-class those domain objects…which is about as far as I’ve made it.

Typically, I use field-level Annotations. Is it possible to due with with the scenario described above? I’m thinking it’s not.

The other thought I had to switch to annotating the properties. In which case, I’d extends the non-annotated domain object, override all the properties, & annotate those. The child would just be a delegate with the required annotations. This just seem like a lot of work/code.

Ironically, I think this would be more easily doable if I was using hbm.xml, which we’ve recently moved away from. Am I missing something with annotations?

  • 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-12T08:00:27+00:00Added an answer on May 12, 2026 at 8:00 am

    The JPA annotations are really your only dependency. If somebody is using your object in a POJO (non DB) way that all they will need is the JPA annotations jar, which for a most application servers is actually on the classpath anyhow.

    Surely just having the annotations as a dependency is pretty reasonable, it’s no like you need to drag in the whole of hibernate and it’s many friends.

    The alternative is as you’ve worked out is to use hbm’s for this entity. It’s not that bad, as hibernate is quite happy mixing annotation and hbm style entities in a single SessionFactory and you can still use field access so don’t need to compromise the public interface to your class.

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

Sidebar

Related Questions

Normally I create web application projects and use code-behind, but I have a requirement
I have a requirement to create a simple database in Access to collect some
I have a requirement to be able to provide a flex component in English
I have a requirement on my current project (a Flex app which will be
I have a requirement to export some data from a table (not all fields
i have a requirement to build some sort of services that can easily be
We have a requirement in project to store all the revisions(Change History) for the
I have a requirement to make a large amount of code MISRA compliant. First
We have a requirement to increase the functionality of a grid we are using
We have the requirement to take a form submission and save some data, then

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.