• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Hibernate Mapping issue with A Foreign key refering

 
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have the tables as in the screenshot above

Class are written as below


Note not added getter and setters

and test code as below



I am getting the below exception


i came to know i should have the 2 attributes in FilterAttribute class to hold the composite key.. But how can we do that?
 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have executed code you provided and I didn't get your exception.

Please provide code which really throws that exception.

You should not declare id property as primitive type.
Change type of id variable to Integer in all entities.

And provide @GeneratedValue annotation for each id variable. I set it to AUTO

This works with test code you provided.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic