I'm having org.hibernate.AnnotationException: Property xxx has an unbound type and no explicit target entity.

Solution Verified - Updated -

Issue

  • The following exception is thrown when Java Persistence API starts:

    javax.persistence.PersistenceException: [PersistenceUnit: IP-PU] Unable to configure EntityManagerFactory
     at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:265)
     at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
     ...
    Caused by: org.hibernate.AnnotationException: Property xxx has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type
    
     at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
     at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
     ... 32 more
    

Environment

  • Enterprise Application Platform
    • 5.0
  • Java Persistence API (JPA)
    • 1.0
  • Domain Model being  (pseudo code)

    @MappedSuperclass
    absctract Person {...}
    
    @Entity
    Male extends Person{...}
    
    @Entity
    MyEntity {
    ...
    @OneToMany
    private Set persons;
    ...
    }
    

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content