posted 17 years ago
Hi guys, could you help me with the following question?
I am confused by B and C. I think there is nothing wrong with C, regarding syntax/restriction/specification. The only reason we should choose B instead of C ,is that B makes more sense in reallife ,right? Or have i mistaken ?Please correct me if i was wrong. Thanks in advance!
15). There are two tables in a database, Celery and Carrot. Celery contains a foreign key to Carrot. Each table has a primary key, and there are no other constraints on the tables. No descriptors are used, and in the following options each scenario depicts all the mapping information pertaining to the relationship. Which entities accurately model this database scenario?
A: @Entity Celery {
/* ... */
}
@Entity Carrot {
@ManyToOne
Celery celery;
/* ... */
}
B: @Entity Celery {
@ManyToOne
Carrot carrot;
/* ... */
}
@Entity Carrot {
/* ... */
}
C: @Entity Celery {
@OneToOne
Carrot carrot;
/* ... */
}
@Entity Carrot {
/* ... */
}
D: @Entity Celery {
/* ... */
}
@Entity Carrot {
@OneToOne
Carrot carrot;
/* ... */
}
[ December 14, 2007: Message edited by: Fofa He ]
SCJP5 (95%)<br />SCBCD5 (96%)<br />SCEA (Preparing...)