Page 1 of 1
About Question enthuware.oce-jpad.v6.2.432 :
Posted: Wed Sep 09, 2015 9:31 am
by romsky
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." ?
Re: About Question enthuware.oce-jpad.v6.2.432 :
Posted: Wed Sep 09, 2015 9:47 pm
by admin
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.
Re: About Question enthuware.oce-jpad.v6.2.432 :
Posted: Thu Sep 10, 2015 12:51 pm
by romsky
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.
My question is not about @CollectionTable, but rather about Your statement:
"@JoinTable annotation is used when there is no additional column in the join table."
Why do You think so?
Re: About Question enthuware.oce-jpad.v6.2.432 :
Posted: Thu Sep 10, 2015 8:42 pm
by admin
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.
Re: About Question enthuware.oce-jpad.v6.2.432 :
Posted: Thu Feb 18, 2016 11:56 am
by l.szepiola
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> ?
Re: About Question enthuware.oce-jpad.v6.2.432 :
Posted: Thu Feb 18, 2016 8:41 pm
by admin
Yes, you are right. Should be fixed.
thank you for your feedback.