[
http://opensource.atlassian.com/projects/hibernate/browse/EJB-240?page=co...
]
Thomas Risberg commented on EJB-240:
------------------------------------
The attribute override is ignored so I get duplicate column name errors:
Exception in thread "main" javax.persistence.PersistenceException:
org.hibernate.MappingException: Repeated column in mapping for entity: jpatest.Employee
column: street (should be mapped with insert="false" update="false")
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
If I only have one embedded field then I don't get the duplicate error. However, the
override does not kick in - the default column names are used.
attribute-override and embedded in orm.xml not working
------------------------------------------------------
Key: EJB-240
URL:
http://opensource.atlassian.com/projects/hibernate/browse/EJB-240
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.0.ga
Environment: 3.2.0GA + HA 3.2.0GA + HEM 3.2.0GA
Reporter: Thomas Risberg
Attachments: Hibernate-JIRA-EJB-240.zip
Embedding an Address class twice and need to override the column names. Using orm.xml
and <embedded> plus <attribute-override> does not work while the same
construct works using annotations. The orm.xml works in the RI.
<embeddable class="jpatest.Address">
<attributes>
<basic name="street"/>
<basic name="city"/>
<basic name="state"/>
<basic name="zip"/>
</attributes>
</embeddable>
<entity class="jpatest.Employee" metadata-complete="false"
access="FIELD">
<attributes>
<id name="id"/>
<basic name="name"/>
<embedded name="homeAddress">
<attribute-override name="street">
<column name="home_street"/>
</attribute-override>
<attribute-override name="city">
<column name="home_city"/>
</attribute-override>
<attribute-override name="state">
<column name="home_state"/>
</attribute-override>
<attribute-override name="zip">
<column name="home_zip"/>
</attribute-override>
</embedded>
<embedded name="mailAddress">
<attribute-override name="street">
<column name="mail_street"/>
</attribute-override>
<attribute-override name="city">
<column name="mail_city"/>
</attribute-override>
<attribute-override name="state">
<column name="mail_state"/>
</attribute-override>
<attribute-override name="zip">
<column name="mail_zip"/>
</attribute-override>
</embedded>
</attributes>
</entity>
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira