[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-381) Make possible to specify an @EmbeddedId's field in a @OneToMany's mappedBy property

Brice Laurencin (JIRA) noreply at atlassian.com
Fri Jul 31 10:17:14 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33686#action_33686 ] 

Brice Laurencin commented on ANN-381:
-------------------------------------

more details:
in fact, the previous code wasn't accurate.
Pool declares poolAdministrators as follows:

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "id.pool")
	@JoinTable(name="POOL_ADMIN")
	private Set<PoolAdministrator> poolAdministrators = new HashSet<PoolAdministrator>(
			0);

Now, if I remove the JoinTable, it tries to work on 
	POOL_ADMIN_USER where POOL_PK_POOL=?
where it should be ADMIN_USER where PK_POOL=?



> Make possible to specify an @EmbeddedId's field in a @OneToMany's mappedBy property
> -----------------------------------------------------------------------------------
>
>                 Key: ANN-381
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-381
>             Project: Hibernate Annotations
>          Issue Type: Improvement
>          Components: binder
>         Environment: Hibernate's annotations packaged in JBoss EJB 3.0 RC8- FD
> Microsoft SQL Server 2000
>            Reporter: Pierre Fourès
>             Fix For: 3.2.0.cr2
>
>
> As described in hibernate forum (http://forum.hibernate.org/viewtopic.php?t=960763) and discussed with Emmanuel, it would be very nice to be able to specify in an @OneToMany's mappedBy property the field of an @EmbeddedId.
> For example, i would like to be able run this example :
> @Entity
> public class Card {
>    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="primaryKey.card")
>    private Set<CardField> fields; 
> }
> @Entity
> public class CardField implements Field {
>    @EmbeddedId
>    private PrimaryKey primaryKey = new PrimaryKey();
>    
>    @Embeddable
>    class PrimaryKey implements Serializable {
>       @ManyToOne(optional = false)
>       private Card card;
>       
>       @ManyToOne(optional = false)
>       private Key key;
>    }
> }
> @Entity
> public class Key {}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list