]
swastika basu commented on HHH-4582:
------------------------------------
I am using Hibernate 3.5.5-Final and I am facing the same issue of Repeated column in
mapping for entity in composite id.
@OneToMany(cascade = { CascadeType.REFRESH, CascadeType.PERSIST,
CascadeType.MERGE }, mappedBy = "cloudProviderproviderId")
private Set<RoleServiceMapping> roleServiceMappingproviderIds;
@ManyToOne
@MapsId("providerId")
@JoinColumn(name = "provider_id", referencedColumnName =
"provider_id", nullable = false, insertable = true, updatable = true)
private CloudProvider cloudProviderproviderId;
When I modify the insertable = false, updatable = false. Everything works fine.
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: