JPA Hibernate illegal access to loading collection

I have used hibernate annotation for a while, and am just now running into a problem when trying a slightly complicated mapping.

The class hierarchy is like this

// no @Entity annotation here
public abstract class Entity implements CommonEntity {

@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public abstract class FlowDiagramObject extends Entity implements Serializable {
      @Column(name = "FLOW_ELEMENT_ID", precision = 22, scale = 0)
      @GeneratedValue(strategy = GenerationType.AUTO)
      protected long id;

public class FlowDiagram extends FlowDiagramObject implements Serializable {

    @OneToMany(mappedBy="parentFlow", cascade={CascadeType.ALL})
      @Cache(usage= CacheConcurrencyStrategy.READ_WRITE)
      protected Set<FlowElement> elements = new HashSet<FlowElement>();      

public abstract class FlowElement extends FlowDiagramObject {
      @JoinColumn (name="parent_object_id")
      protected FlowDiagram parentFlow;            // only used to point to diagram element

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class CommandElement extends FlowElement {


I am able to using HQL to get a FlowDiagram object, but when accessing its children


I get a illegal access to loading collection exception.

I am completely sure this is done inside the session, so that is not the problem. There must be something wrong with my mapping.

Anyone see the problem?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Did you notice any Select SQL statement being sent to the DB and logged at the moment the line is called?
bhomassAuthor Commented:
I found the answer by experimenting.

The intermediate subclass FlowElement can not be abstract. Hiberate mapping fails otherwise. Unless someone knows how to tune mapping to allow for the abstract qualifier to remain.
Definitely not, I used these intermediate subclass a lot.

Could it be the typo there in the annotation of the class FlowElement? Something @Entity should be @javax.persistence.Entity.

If merely looking from the exception, that sounds related to some fundamental java standard library feature, such as ClassLoader, etc.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

bhomassAuthor Commented:
and you used for single table per hierarchy strategy using a discriminator column?
bhomassAuthor Commented:
I can not repeat the expert's suggestion, but I believe his comments are true.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.