About Question enthuware.oce-jpad.v6.2.554 :

Moderator: admin

Post Reply
M_Z

About Question enthuware.oce-jpad.v6.2.554 :

Post by M_Z » Wed Mar 14, 2012 5:07 pm

"...unidirectional one-to-many association"

Why option #3 is not correct ?

Even explanation says that it's correct. ;)

Also, there is a possiblity to create OneToMany unidirectional association without join table:

Code: Select all

@Entity
public class Employee {
  @Id
  @Column(name="EMP_ID")
  private long id;
  ...
  @OneToMany
  @JoinColumn(name="OWNER_ID", referencedColumnName="EMP_ID")
  private List<Phone> phones;
  ...
}

Code: Select all

@Entity
public class Phone {
  @Id
  private long id;
  ...
}

admin
Site Admin
Posts: 8297
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by admin » Wed Mar 14, 2012 7:44 pm

I see that Option 3 is indeed marked as correct.
Yes, it is possible to create a one to many relationship without join table, but that is not relevant in this question.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

M_Z

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by M_Z » Thu Mar 15, 2012 3:07 pm

Sorry, I was wrong.

I thought option 2 was correct (and therefore option 3 was wrong). :?

crolip
Posts: 6
Joined: Mon Jun 16, 2014 9:47 am
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by crolip » Tue Aug 25, 2015 7:58 pm

In question enthuware.oce-jpad.v6.2.429 is showed that is possibile to create a one-to-many association without the usage of a joinTable, so why option three is correct?

admin
Site Admin
Posts: 8297
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by admin » Tue Aug 25, 2015 9:42 pm

crolip wrote:In question enthuware.oce-jpad.v6.2.429 is showed that is possibile to create a one-to-many association without the usage of a joinTable, so why option three is correct?
Yes, but this question doesn't ask, "join table is must for which associations". It is only asking where jointable is used. It is used for unidirectional one-to-many association also.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Igor Makarov
Posts: 14
Joined: Tue Sep 08, 2015 3:27 am
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by Igor Makarov » Thu Sep 24, 2015 2:29 pm

Hi.
May be it would be better to rephrase a bit the question. Instead of "A JoinTable is used..." write "A JoinTable is placed on..."?

admin
Site Admin
Posts: 8297
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by admin » Fri Sep 25, 2015 8:43 am

Igor Makarov wrote:Hi.
May be it would be better to rephrase a bit the question. Instead of "A JoinTable is used..." write "A JoinTable is placed on..."?
I am not sure what "is placed on" implies. "used" is quite clear in the sense that you need to use this annotation when you are creating a OneToMany or ManyToMany relationship. How exactly it is used is a different matter.

thank you for your feedback!
-Paul.
If you like our products and services, please help us by posting your review here.

tanzwud
Posts: 19
Joined: Mon Sep 01, 2014 9:45 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by tanzwud » Fri Jul 01, 2016 3:51 am

Why option 4 is invalid?
"for all one-to-many as well as many-to-many associations."
11.1.23
"A join table is typically used in the mapping of
many-to-many and unidirectional one-to-many associations. It may also be used to map bidirectional
many-to-one/one-to-many associations, unidirectional many-to-one relationships, and one-to-one associations
(both bidirectional and unidirectional)."
Sounds like in any many-to-many and one-to-may unidirectional/bidirectional.
Thx, Ivan.

admin
Site Admin
Posts: 8297
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by admin » Fri Jul 01, 2016 9:47 am

tanzwud wrote:Why option 4 is invalid?
"for all one-to-many as well as many-to-many associations."
...
Sounds like in any many-to-many and one-to-may unidirectional/bidirectional.
Thx, Ivan.
Yes, it "may" be but not necessarily so.
If you like our products and services, please help us by posting your review here.

javabean68
Posts: 29
Joined: Wed Mar 16, 2016 8:38 am
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by javabean68 » Thu May 04, 2017 8:09 am

Hallo

I find the option 4 a bit confusing...
"for all one-to-many as well as many-to-many associations."

It should be 'for some'...shouldn't it?

Thank you
Fabio

admin
Site Admin
Posts: 8297
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by admin » Thu May 04, 2017 10:35 am

No, the problem statement contains, "may be". A join table may indeed be used for all one-to-many as well as many-to-many associations.
If you like our products and services, please help us by posting your review here.

javabean68
Posts: 29
Joined: Wed Mar 16, 2016 8:38 am
Contact:

Re: About Question enthuware.oce-jpad.v6.2.554 :

Post by javabean68 » Fri May 05, 2017 4:16 am

Upsi, sorry I didn't read the answer before!

Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests