Issue Type: Bug Bug
Affects Versions: 4.1.6
Assignee: Unassigned
Components: core
Created: 19/Feb/13 1:49 PM
Description:

I created the following mapping configuration:

EntityA.java
~~~
@Entity
@Table(name="TableA")
@SecondaryTables({@SecondaryTable(name = "TableB")})
public class EntityA { @Id Integer id; @Embedded EmbeddableA embed; // getters and setters }
~~~

EmbeddableA.java
~~~
@Embeddable
public class EmbeddableA {

@Embedded
@AttributeOverrides({@AttributeOverride(name = "embedAttrB" , column = @Column(table = "TableB"))})
EmbeddableB embedB;

String embedAttrA;

// getters and setters

}
~~~

EmbeddableB.java
~~~
@Embeddable
public class EmbeddableB { String embedAttrB; // getters and setters }
~~~

Which created the following Table structures:

----------- -------------

TableA   TableB

----------- -------------

id   id
embedAttrA   embedAttrB

----------- -------------

After trying to persist, the following Exception is thrown:

Caused by: org.hibernate.exception.SQLGrammarException: Unknown column 'embedAttrB' in 'field list'

To make this work, I moved EmbeddableB directly into EntityA, with the original AttributeOverride annotations. Now that the @Embeddables aren't nested, EmbeddableB persists to TableB, as was the original intent. It appears that the table attribute in the AttributeOverride is not being applied @Embeddable classes are nested, even though the column attribute is applying properly and we get an error if TableB is not setup as a secondary table in the entity.

Project: Hibernate ORM
Labels: jpa2
Priority: Major Major
Reporter: Ricardo Martinelli de Oliveira
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira