The Customer bean maps its address properties to a separate ADDRESS table. The first thing it does is define the secondary table.
@Entity
@Table(name = "CUSTOMER")
@SecondaryTable(name = "EMBEDDED_ADDRESS", join = {@JoinColumn(name = "ADDRESS_ID")})
public class Customer implements java.io.Serializable
{
The @JoinColumn of the secondary table must match the value of the Customer's primary key.
To map individual properties to a secondary table you use the secondaryTable member value of @Column.
@Column(name = "STREET", secondaryTable = "EMBEDDED_ADDRESS")
public String getStreet()
{
return street;
}
Unix: $ export JBOSS_HOME=<where your jboss 4.0 distribution is>
Windows: $ set JBOSS_HOME=<where your jboss 4.0 distribution is>
$ ant
$ ant run
run:
[java] Create Bill Burke and Monica Smith
[java] 2004-10-06 22:27:50,344 INFO org.jboss.remoting.InvokerRegistry[main] - Failed to load soap remoting transpo
rt: org/apache/axis/AxisFault
[java] Bill and Monica get married
[java] Get all the Burkes
[java] There are now 2 Burkes
The INFO message you can ignore. It will be fixed in later releases of JBoss 4.0.