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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:06:12+00:00 2026-05-15T21:06:12+00:00

I have to design a data model (in a Java EE 6 application) that

  • 0

I have to design a data model (in a Java EE 6 application) that will be persisted via JPA, and that also needs to be serialized via JAXB. The last time I did that, I had one group of entity classes with JAXB annotations, and another with JPA annotations. This meant that I had to have a lot of boilerplate code for translating between the two. I’m thinking of combining them, so that each class will have both types of annotations. I know this can be done, but my question is, should it be? Will it cause any problems?

  • 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-15T21:06:13+00:00Added an answer on May 15, 2026 at 9:06 pm

    The question is a little too broad for me to answer. But I do have specific related experience using Jackson under JAXB with JPA entities that you might find interesting.

    In my case, I had a JPA model with roughly three dozen entities and lots of cyclic references. The graph of relationships between entities was also almost strongly connected. In other words, it was possible to navigate to nearly any entity in the set from any other by following entity relationships. In my case, with entities as described and Jackson 1.5, overlaying JAXB annotations on my JPA entities turned out to be a bad idea.

    For one thing, Jackson 1.5 got into infinite recursion on the cyclic references. I consider that operator error rather than a bug. Jackson is awesome software. Also, I think the upcoming 1.6 release provides new features to handle this per JACKSON-235. So this might be moot soon!

    My other difficulty related to serialized compactness in the face of strongly connected entities. Serializing all my entity relationships was impractical. I would have serialized an obscene amount of irrelevant information in every request by naively following all entity relationships to their full depth.

    I wanted to specify multiple serializations of my JAXB objects, choosing one with appropriate fields and relationships depending on the intended use. But, as far as I’m aware, JAXB and Jackson offer no such flexibility. They offer significant flexibility in defining the representation — what’s transient, how lists look, etc. — but I don’t think multiple representations are possible for one object. Maybe there’s a clever way to define multiple representations under JAXB or Jackson and switch at runtime… I’d be interested to learn if such a thing exists. Perhaps there’s a feature for this that I’m ignorant of, or some trickery that can be played with subclassing. But I couldn’t find it, so ultimately I gave up and went with DTOs.

    Again, this is all pretty specific to the model. Maybe these are non-issues for you (or maybe you have clever solutions for these problems!)

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

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Actually Objective C has a powerful set of introspection features,… May 16, 2026 at 11:35 pm
  • Editorial Team
    Editorial Team added an answer The array environment is the way to go here. This… May 16, 2026 at 11:35 pm
  • Editorial Team
    Editorial Team added an answer You can do this programatically & in XML - but… May 16, 2026 at 11:35 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I've been developing an in-house DSP application (Java w/ hooks for Groovy/Jython/JRuby, plugins via
I have a question about GUI design, specifically with Java Swing and creating clean
I have this problem where I need to design a Java package which is
I would like to design webapps (eg. games) that have low latency. I presume
I am developing a GUI application in C# using the design mode in VS2008.
Building decent RIA data-intensive crud-like application is still hard. In spite of existence tons
I'm implementing a new machine learning algorithm in Java that extracts a prototype datastructure
I have to write a multiplayer pacman game in Java for a university assignment
I have a question, but let me first say that this is being performed
I have a such a data structure, ID NAME BIRTH AGE SEX ================================= 1

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.