Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Lookup tables and foreign keys.  RSS feed

Posts: 17314
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this it possible, or should be done?

You have a table that has a foreign key to a "lookup" table. Say for instance Order Status. So in the Order Header table you have the Foreign Key to the Order status. Now on the client side the user wants to select a nice pretty String representation of the status, but you want to save the PK of that record in the Order Header Table.

Should you

A) Put both the ID field and the String into the POJO representing the Order Header.
----1) Would the client just put in the String and allow Hibernate to find the FK?
----2) Or would the client be required to put in the FK?
B) Keep just the ID field and the client has to do a lookup to the database?

Can Hibernate solve this kind of issue?


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!