• 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

Invalid composite primary key specification

 
Ranch Hand
Posts: 146
2
Mac Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know this topic has come up in the past, but after looking through previous posts and a lot of "Googling" I am still utterly confused as to why I get the above error. The relevant exception in full is:

The relevant sections of my entity classes are shown below.

User.java

FlyingClub.java

FlyingClubStaff.java

Relevant database schema (if needed)

Since I have annotated the fields with @Id in the entity class I have not added any reference to them in persistence.xml.

Any help / pointers in the right direction welcome.
 
Bartender
Posts: 1849
15
Eclipse IDE Spring VI Editor Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where's the class named FlyingClubStaffID?

@IdClass(FlyingClubStaff.FlyingClubStaffID.class)
 
Ashley Bye
Ranch Hand
Posts: 146
2
Mac Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would appear I forgot to post that class. I solved the problem using an embeddable class and an embedded id. I say I solved the problem, I gave up and got NetBeans to solve the problem for me. I'll revisit coding it by hand another time. For now, I've stepped down a notch to a smaller project which doesn't have any composite keys so I can get the hang of things - people don't run before they learn to crawl and walk after all!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic