[hibernate-issues] [Hibernate-JIRA] Assigned: (HHH-4582) Repeated column in mapping for entity in composite id
Hardy Ferentschik (JIRA)
noreply at atlassian.com
Wed Nov 18 03:52:08 EST 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hardy Ferentschik reassigned HHH-4582:
--------------------------------------
Assignee: Hardy Ferentschik
> 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