Solved

J2EE.EJB.container-managed-relations: Are they necessary?

Posted on 2004-07-30
8
209 Views
Last Modified: 2013-12-03
I'm creating several entity beans that use CMP to access a MySQL database. I've already added constraints to the tables in the database using SQL commands. However, I read that the constraining relationships between entity beans (one-to-one, one-to-many, etc.) can also be specified in the deployment descriptors (xml files). If I were to make use of these container-manged-relations, would it still be necessary to use foreign key constraints in the database? If I choose to leave all of the constraints in the database, is there a reason to specify contain-managed-relations?

Thanks.
0
Comment
Question by:bobwood2000
  • 4
  • 2
8 Comments
 
LVL 30

Accepted Solution

by:
mayankeagle earned 500 total points
ID: 11687592
Treat the database as a separate, independent entity. The database should be a replica of the real-world objects, so if the relationship actually exists, the database should reflect it.

Today, you're using an EJB to access it. Tomorrow, you might be accessing the DB through a .NET application or through some other application (or maybe just simple queries/ stored procedures).

The DB design and relationships should always be complete.
0
 

Author Comment

by:bobwood2000
ID: 11719634
Thanks.
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 11723055
Welcome, but why a B :-( ? I thought I gave sufficient explanation.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 30

Expert Comment

by:mayankeagle
ID: 11723057
I hope you know about the grading system at EE.
0
 

Author Comment

by:bobwood2000
ID: 11738738
I thought Mayankeagle gave a helpful response, and since it was the only response I received, I accepted it. However, it did not fully answer the question I asked, so I thought B ("good") was more appropriate than "perfect". Upon reading about the grading system, I see that I may have misused the grading system. If so, please change the grade to an A. Thanks, and sorry for difficulty.
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 11742282
Thanks, bobwood2000. The answer I gave was short but I guess that it was concise and complete. I gave you at least 3 vital reasos why you should maintain the relationships in the database:

1. The database should be a complete replica of the real-world entities that it represents and so, the relationships must be complete.

2. The database is a separate entity, so treat it as one. Don't couple it to your J2EE application.

3. Maintaining the database relationships prefectly will help you access it from any other application, like a C# or VB or ASP .NET application too, because it is indeed a separate entity accessible from anywhere.

:-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now