• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity Problem

 
ryan sukale
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I was developing an application using EJB 3 and netbeans 6.1. I am using MySQL.
Now, as netbeans allows us to create entity beans directly by inspecting a database, i tried to use that feature.
My database contains a table that does not have a primary key. Netbeans does not let me add that table through the interactive tool.
Then i tried by creating my entity class manually. But then again it asks me to compulsorily add a primary key.

The problem is that my the table which i need to map as an entity is a join table that contains the primary keys of three separate tables as foreign keys and also some additional data. So, i need to access that table as an entity.

My question is that is it not allowed to create an entity without a primary key? Or is it just netbeans thats creating unwanted problems and doubts in my mind.(no offense intended).

Kindly suggest where i am going wrong or how i might rectify it.

Thanks in advance.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a JPA requirement. Every entity must have a primary key.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic