• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

org hibernate PropertyAccessException

Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have 3 tables in my database:


and mapped them as a ManyToMany-Relation:

The relationship works well by doing some HQLs (JPA-QLs). But when I want to persist a new Person-Instance, the following stacktrace occurs:

This is my session-bean:

This is my view to obtain the list of selected roles (this works):

The persist works only, if the user will not select any roles. Then a person-instance with its name and id will be stored in the database. By persisting any roles, the stacktrace above occurs.

I have tried a lot but I cannot solve the problem.
Any Idea, how I can solve that problem??

nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not understand, why Hibernate complains that the "object is not an instance of declaring class" when searching the primary key from Table ROLE. I know, Users is my actual instance..but Hibernat cannot save a User-Record without considering the m:n-Relation..I mean, it should save the join-table automatically open a new session for that..

Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic