• 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

Entity Problem

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a JPA requirement. Every entity must have a primary key.
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic