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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:26:19+00:00 2026-05-24T10:26:19+00:00

I have a large non-Java EE, JSF-based web app project. Our system is layered

  • 0

I have a large non-Java EE, JSF-based web app project. Our system is layered (in the source code sense): there’s a data model package, building on that is the DAO package. We are using Hibernate’s XML configuration mapping exclusively in the DAO package. We really don’t want to muddle the data model with annotations, but aren’t wedded to Hibernate specifically (except that the mapping is quite complex).

I’m strongly considering making a move towards Java EE and building our DAO objects as EJBs. But as we’re unwilling to discard Hibernate’s XML, this leads me to several questions:

  • Is it possible to use Hibernate with JPA without JPA annotations on the model?
  • If not, is it possible for my EJBs to behave transactionally with Hibernate anyway? I think this is called JTA support, but not sure. I like the idea of getting transactions “for free”; right now we have a custom-coded phase listener I’d like to remove which handles Hibernate transactions.
  • Is there a way to migrate from Hibernate’s XML mapping configuration to some sort of JPA XML mapping? I don’t see a way to do this, but obviously it would be better to reduce our coupling to Hibernate.

Thanks!

  • 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-24T10:26:19+00:00Added an answer on May 24, 2026 at 10:26 am

    Is it possible to use Hibernate with JPA without JPA annotations on the model?

    Yes, this is quite possible. You can specify all pertinent attributes of your object model classes, in JPA standard mapping file – orm.xml. Your can also have your own mapping files, but you’ll need to specify them in the persistence.xml.

    If not, is it possible for my EJBs to behave transactionally with Hibernate anyway? I think this is called JTA support, but not sure.

    If you are using EJBs, you’ll find container managed transactions to be quite useful. All you need to do is to annotate your EJBs with the required @TransactionManagement and @TransactionAttribute annotations, and the container will automatically manage the transactions for you, including committing the transaction at the end of the method (if applicable), and rolling back the transaction in the event of a runtime exception or an application exception.

    All EntityManager instances, i.e. all persistence contexts, injected into such EJBs, would automatically be associated with the underlying JTA transaction. Note, that this is true only if you allow the container to inject EntityManager instances. If you manage the persistence contexts yourself (by creating them from EntityManagerFactory instances), then you might have to invoke EntityManager.joinTransaction() to associated all the work performed in the persistence context with the underlying JTA transaction. This is necessary as the EntityManager typically associates itself with the underlying JTA transaction, if you have configured the persistence context to use JTA datasources. If no JTA transaction exists, then no such association will occur, and therefore you will have to join with an active JTA transation if you want to flush the changes to a database.

    Is there a way to migrate from Hibernate’s XML mapping configuration to some sort of JPA XML mapping?

    I’m unaware of any such tool as I’ve never had to migrate a project, but that does not mean that there are none to serve this purpose. You might want to take a look at the Hibernate Tools project, which does support JPA, although I’m unsure of whether it will allow you to convert from the Hibernate XML format to the JPA format.

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

Sidebar

Related Questions

We have an existing java-based heavyweight project that needed an interactive script interpreter. After
I have a large tree of Java Objects in my Desktop Application and am
I would like to know, in a practical sense, on a large scale (Java
First, a bit of my background. I have been working on large web systems
I have a new web app that is packaged as a WAR as part
I have a large non-map image that I want to allow people to view
I have a large list of non-unique named values, i.e.: tscores 11461 11461 11461
in my app, i have large images, i display it in an image view
I have large data sets (10 Hz data, so 864k points per 24 Hours)
I have large batches of XHTML files that are manually updated. During the review

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.