[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4582) Repeated column in mapping for entity in composite id

Franck Bisti (JIRA) noreply at atlassian.com
Thu May 26 04:21:25 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42410#action_42410 ] 

Franck Bisti commented on HHH-4582:
-----------------------------------

I don't understand your answer while i can find in hibernate documentation :
While not supported in JPA, Hibernate lets you place your association directly in the embedded id component (instead of having to use the @MapsId annotation).
Or I misunderstood.

> Repeated column in mapping for entity in composite id
> -----------------------------------------------------
>
>                 Key: HHH-4582
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4582
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>         Environment: Hibernate 3.3.1
>            Reporter: Franck Bisti
>            Assignee: Hardy Ferentschik
>            Priority: Minor
>         Attachments: PersistentClass.java
>
>
> I have a composite-id with 2 manytoone. The two manytoone are composed by 3 columns each. They share 2 columns. 
> @Embeddable
> public class FooBarId implements Serializable {
>     @ManyToOne()
>     @JoinColumns({
>         @JoinColumn(name="FOO_BAR1", referencedColumnName="FOO_BAR1",nullable=false, updatable=true, insertable=true),
>         @JoinColumn(name="FOO_BAR2", referencedColumnName="FOO_BAR2",nullable=false, updatable=true, insertable=true),
>         @JoinColumn(name="FOO_ID", referencedColumnName="ID",nullable=false, updatable=true, insertable=true)
>     })
>     private Foo foo;
>         
>     /** Attribute*/
>     @ManyToOne()
>     @JoinColumns({
>         @JoinColumn(name="FOO_BAR1", referencedColumnName="FOO_BAR1",nullable=false, updatable=false, insertable=false),
>         @JoinColumn(name="FOO_BAR2", referencedColumnName="FOO_BAR2",nullable=false, updatable=false, insertable=false),
>         @JoinColumn(name="BAR_ID", referencedColumnName="ID",nullable=false, updatable=false, insertable=false)
>     })
>     private Bar bar;
> Exception :
> Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.test.FooBar column: FOO_BAR2 (should be mapped with insert="false" update="false")
> 	at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:670)
> 	at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:711)
> 	at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468)
> 	at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
> 	at org.hibernate.cfg.Configuration.validate(Configuration.java:1135)
> 	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
> 	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:854)
> 	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
> I have the "Repeated column in mapping" exception because Hibernate doesn't use the insertable and updtable property in the PersistentClass.checkColumnDuplication for composite-id.
> I have modified the PersistentClass.checkColumnDuplication() by use of getColumnUpdateability code and it seems to works fine (see attached file)
> I don't know if that can help

-- 
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