-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: org.hibernate.AnnotationException: any ideas?
PostPosted: Thu Nov 05, 2009 7:04 am 
Newbie

Joined: Thu Nov 05, 2009 6:55 am
Posts: 1
I'm getting a Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: model.Rol.Acteur in model.Acteur.rollen exception.

Now I don't really see anything wrong with these classes (both are in the package model):

Code:
@Entity
@Table(name = "T_ACTEUR")
public class Acteur {
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Acteur")
    @SequenceGenerator(name = "Acteur", sequenceName = "SEQ_ACTEUR", allocationSize = 1)
    private int id;
    private String voornaam;
    private String familienaam;

    @OneToMany(mappedBy = "Acteur")
    private Set<Rol> rollen = new HashSet<Rol>();

    public Acteur(String voornaam, String familienaam, Set<Rol> rollen) {
        this.voornaam = voornaam;
        this.familienaam = familienaam;
        this.rollen = rollen;
    }

    //getters
    //setters
    /add Rol function
}


Code:
@Entity
@Table(name = "T_ROL")
public class Rol {
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Rol")
    @SequenceGenerator(name = "Rol", sequenceName = "SEQ_ROL", allocationSize = 1)
    private int id;
    private String naam;

    @ManyToOne
    @Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE})
    @JoinColumn(name = "acteurId")
    private Acteur acteur;

    @ManyToOne
    @Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE})
    @JoinColumn(name = "filmId")
    private Film film;

    public Rol(String naam, Acteur acteur, Film film) {
        this.naam = naam;
        this.acteur = acteur;
        this.film = film;
    }

    //getters
    //setters
}


They're both declared in my hibernate.cfg.xml, and I don't really see anything wrong with them.

Any input is welcome.

The error list:
Code:
Initial SessionFactory creation failed.org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: model.Rol.Acteur in model.Acteur.rollen
Exception in thread "main" java.lang.ExceptionInInitializerError
   at persistence.HibernateUtil.<clinit>(HibernateUtil.java:23)
   at model.test.main(test.java:23)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: model.Rol.Acteur in model.Acteur.rollen
   at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:543)
   at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:508)
   at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1136)
   at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
   at persistence.HibernateUtil.<clinit>(HibernateUtil.java:18)
   ... 6 more


If it's helpful in any way.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.