• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;


 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic