wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes org.hibernate.AnnotationException: mappedBy reference an unknown target entity property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "org.hibernate.AnnotationException: mappedBy reference an unknown target entity property" Watch "org.hibernate.AnnotationException: mappedBy reference an unknown target entity property" New topic
Author

org.hibernate.AnnotationException: mappedBy reference an unknown target entity property

peter kosmas
Ranch Hand

Joined: Aug 26, 2008
Posts: 79
Hello ...
I have a problem by mapping these two tables

i want the keys that are mapped not to be generated...
but to be entered manually ..
I am new to JPA and trying some examples ...
Can someone help ???

Create a row with isbn xx
and insert by that isbn 1-2-3 Instances with data by that isbn
the problem is i get the exception :
Exception in thread "main" org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: jpa.beans.BookInfo.bookInfo in jpa.beans.Book.bookInfo
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:576)







So i use this example and get









import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import jpa.beans.Book;
import jpa.beans.BookInfo;
import org.hibernate.SessionFactory;

import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.classic.Session;

import org.hibernate.tool.hbm2ddl.SchemaExport;



Time is relative so there is no way i can be late.
~Albert Einstein~
Shannon McGee
Greenhorn

Joined: Oct 01, 2009
Posts: 18
Hi Peter,

I would start by removing the "mappedBy" annotation from the getBookInfo method. You shouldn't need any additional annotations for this relationship

This annotation is typically used to map the reverse side of a relationship that has already been captured in another class.

A side note: you may find that it's easier to put the attribute annotations above each attribute declaration. I didn't see anything in your code that would necessitate using the annotations at the method level.

-Shannon
 
GeeCON Prague 2014
 
subject: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property