• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA mapping error  RSS feed

 
Fernando Guerrero
Greenhorn
Posts: 21
Eclipse IDE Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to run an application , but I am getting the error:
Deployment failed. The message was: Exception Description: The @JoinColumns on the annotated element [field usersCollection] from the entity class [class com.myentities.Tickets] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referencedColumnName elements must be specified in each such @JoinColumn
This is the code for my Users entity



This is the code for my Tickets entity


This is my ticketPK class:



In my Users table, only the U_NAME field is my primary key.
In my Tickets table ticket_id and version_num fields are my primary key.
There is another table called tickets_users, this table has a column called user_name, this column is a foreign key, references u_name in users table. Also there is a column called ticket_id, this column is a foreign key, references ticket_id in tickets table.

Should I have also created a field called version_num in my tickets_users table and mapped in my tickets entity?  What I am missing?

Thanks





 
L Foster
Ranch Hand
Posts: 242
14
Android Angular Framework AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Fernando:

I think this is what will get you past the current problem.  Basically, you have to list all the fields in the embedded, multicolumn key.


However, you may have another problem awaiting you in the UsersInfo collection.  However, you did not post that code, so I do not know what to do with that.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!