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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:01:45+00:00 2026-06-01T15:01:45+00:00

I have a moderately complex application using POJOs, and now come to migrated it

  • 0

I have a moderately complex application using POJOs, and now come to migrated it to EJB3.1 so it can be deployed online, accessed through REST services and benefit from the container environment (persistence being the most major, but transactions would be useful too).

I have been away from Java EE since the J2EE days, and am struggling to get my head around the “loss” of entity beans. It took me a while to realise that Entities in EJB3.1 are not actually Beans in the old sense… 🙂 I have read a number of EJB3 books including the O’Reilly Enterprise JavaBeans 3.1 “manual”, all of which explain the concepts and components of EJB3 but not the implementation pattern options.

In my research and investigation looking for Java EE 6 patterns I’m rather taken by Adam Bien’s approach – particularly the “Persistent Domain Objects” (PDO) pattern (in his book but summarised here too: http://download.java.net/general/podcasts/real_world_java_ee_patterns.pdf), which appears to offer the least complexity and most synergy with my current POJO app. PDO also closely-aligns with the traditional Object Oriented philosophies and approach, and really appeals to me.

Rather than resparking a debate over PDO, I’m interested to hear from people that have implemented it and what worked vs. where you had difficulties. In particular I’d like to find out how you made calls from JPA entities out into other services in the container (like calls to stateless session beans etc).

I’d also love to know if there are alternatives to the PDO pattern that allow me to maintain the application structure (using polymorphism etc) without having to create a session bean and a JPA entity for every class in my model. (I don’t want to do that partly because of the massive exercise required to refactor all of the unit and integration tests, and partly because – as far as I can see – I’ll end up trying to replicate my 1toMany etc object relationship across my session beans too which seems crazy).

Does anyone have any experiences to share – or if you’d like to point out I’m an idiot and have missed something fundamental in Java EE 6 that would be “welcome” too 🙂

TIA

  • 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-01T15:01:47+00:00Added an answer on June 1, 2026 at 3:01 pm

    No replies so maybe I’m the only one doing it 😉 For anyone else looking for pointers, I have found:

    • your object model needs major modification. You can’t use Maps or
      Lists of interfaces as you would in a non-JPA app, because JPA can’t
      “handle” interfaces, you need to persist (abstract) classes.
      Hibernate has an @Any and @ManyToAny annotation, but the overhead
      (performance, functionality and coding) is (IMHO) significant. If
      you can implement a hideous abstract class hierarchy then you should.
      YUK!

    • If you have a vaguely complex object model (more than six relationships between objects) you will end up with LOTS of JOIN commands in the SQL code that is generated by the JPA engine. I read somewhere that >6 JOINS puts a high load on the database (just a rule-of-thumb I’m sure). MySQL has a hard limit of 61 joins. Sounds crazily high, surely you’d never hit that?! If you’ve got an abstract object hierarchy and a few relationships between objects it soon adds up!

    I haven’t found a way to get around the first “problem”. It feels wrong to ram-in lots of abstract base classes instead of interfaces, but it’s unavoidable as far as I can see. Please tell me if not!

    The second problem can be managed by using lazy-fetch on object relationships, or by using Adam’s Gateway pattern and extended persistence sessions (rather than stateless session beans loading and saving the model on every call). I’m going with the latter so far – but haven’t got to a point where I can load-test on the memory and database usage yet. We’ll see!

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

Sidebar

Related Questions

We have a moderately complex silverlight based application written in Silverlight 2. Eventually we
I have a moderately complex layout with several clickable elements. When the user clicks
I have an application that needs to send a moderately high volume of messages
I have a moderately complex PHP if statement with a few levels. Took me
I have a moderately complex report consisting of a lot of subreports. One particular
We have an application running on Weblogic 8.1.3, using the bundled 1.4.2 JDK, and
I have a moderately sized dataset in excel from which I wish to extract
Have a matrix report now that has Position, Hours and Wages for a location
I'm trying to create a moderately complex query with joins: SELECT `history`.`id`, `parts`.`type_id`, `serialized_parts`.`serial`,
I'm new to git and I have a moderately large number of weekly tarballs

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.