Change By: Brett Meyer (21/Feb/13 10:00 AM)
Description: I created the following mapping configuration:

EntityA.java
{code}
@Entity
@Table(name="TableA")
@SecondaryTables({@SecondaryTable(name = "TableB")})
public class EntityA {

@Id
Integer id;

@Embedded
EmbeddableA
 embed  embedA ;

        // getters and setters

}
{code}

EmbeddableA.java
{code}
@Embeddable
public class EmbeddableA {

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

String embedAttrA;

        // getters and setters

}
{code}

EmbeddableB.java
{code}
@Embeddable
public class EmbeddableB {

String embedAttrB;

        // getters and setters

}
{code}

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