This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Is it ok to drop the foreign keys created by EJB 3 on the database?  RSS feed

 
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can you please let me know what will happen if I delete the foreign keys created by EJb 3 in my database?

Thanks
 
Bartender
Posts: 2651
18
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

raminaa niilian wrote:Hi,

Can you please let me know what will happen if I delete the foreign keys created by EJb 3 in my database?

Thanks

Drop the columns, or drop the constraints?
 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The constraint and not the columns.

Thanks
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

raminaa niilian wrote:
The constraint and not the columns.

Thanks



I'm not sure about the scenario. But if you drop the constraint, the jpa won't be able to retrieve the attribute as an instance of the entity the foreign key references. ie, entity A has an attribute person which is an int that references to the Id of entity Person. If the foreign key is lost, person will be an int instead of being an instance of Person. Is that what you mean?
 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

alice zhu wrote:

raminaa niilian wrote:
The constraint and not the columns.

Thanks



I'm not sure about the scenario. But if you drop the constraint, the jpa won't be able to retrieve the attribute as an instance of the entity the foreign key references. ie, entity A has an attribute person which is an int that references to the Id of entity Person. If the foreign key is lost, person will be an int instead of being an instance of Person. Is that what you mean?




Do you mean that JPA uses the FK themselves to make multiplicity relations? I think they use the related database column to do that and not the FK itself. My doubt is that dropping the fks may cause other unexpected problems.
 
This is my favorite tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!