The 4th option works ok with Hibernate.
Why do You think that "@JoinTable annotation is used when there is no additional column in the join table." ?
About Question enthuware.oce-jpad.v6.2.432 :
Moderators: Site Manager, fjwalraven
-
- Posts: 39
- Joined: Thu Jan 29, 2015 4:49 pm
- Contact:
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.432 :
As per Section 2.7.2, when the value type of the map is a basic type or an embeddable class, a collection table is used to map the map.
Here, ProjectAllocation is not an entity but an embedded class, that is why CollectionTable is more appropriate.
Here, ProjectAllocation is not an entity but an embedded class, that is why CollectionTable is more appropriate.
If you like our products and services, please help us by posting your review here.
-
- Posts: 39
- Joined: Thu Jan 29, 2015 4:49 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.432 :
My question is not about @CollectionTable, but rather about Your statement:admin wrote:As per Section 2.7.2, when the value type of the map is a basic type or an embeddable class, a collection table is used to map the map.
Here, ProjectAllocation is not an entity but an embedded class, that is why CollectionTable is more appropriate.
"@JoinTable annotation is used when there is no additional column in the join table."
Why do You think so?
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.432 :
Because if there are additional columns, you use the @CollectionTable. It follows from the same statement. If there are no additional columns, you can use @JoinColumns just like you do for any other one to many or many to many relationship.
If you like our products and services, please help us by posting your review here.
-
- Posts: 2
- Joined: Thu Jan 07, 2016 3:33 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.432 :
Hello! Since the joinColumn element of @CollectionTable is not specified, shouldn't the join column name in EMP_PROJECTS table be defaulted to EMPLOYEE_<Name of id attribute> ?
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.432 :
Yes, you are right. Should be fixed.
thank you for your feedback.
thank you for your feedback.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 47 guests