jbossejbmyeclipseejb-2.xxdoclet

Specify table name for ejb 2.1 many to many relationship


I have an ejb 2.1 m:n relationship. The table is being created automatically. The thing is I want to specify the table name that is going to be created by this relationship.

The question:
Does a many to many relationship have an attribute to specify which table name I want to be created instead of the default table name (which is a concatenation of the tables involved in the relationship)? Or there is another way to achieve that?

Details
I am using:

I am pretty sure the question is specific enough, but in any case below is the relationship code

/**
 * @ejb.interface-method view-type="both"
 * @ejb.relation
 *     name="empresas-campanhas"
 *     role-name="campanha de empresas"
 *     target-role-name="empresas tem campanhas"
 *     target-ejb="Empresa"
 *     target-multiple="yes"
 * @ejb.value-object
 *     compose="<package>.EmpresaValue"
 *     compose-name="EmpresaValue"
 *     members="<package>.EmpresaLocal"
 *     members-name="EmpresaLocal"
 *     relation="external"
 * @jboss.relation
 *     fk-column="id_empresa"
 *     fk-constraint="true"
 *     related-pk-field="idEmpresa"
 * @jboss.target-relation
 *     fk-column="ID_CampanhaFidelidade"
 *     fk-constraint="true"
 *     related-pk-field="idCampanhaFidelidade"
 */
public abstract Collection getEmpresas();

/**
 * @ejb.interface-method view-type="both"
 */
public abstract void setEmpresas( Collection empresas );

It is being created the table:

campanhafidelidade_empresas_empresa_campanhafidelidade_empresas

But I want to specify:

syo_campanhafidelidade_empresas.


Solution

  • You should put the following annotation in the getEmpresas() method:

    @jboss.relation-table table-name="SYO_CampanhaFidelidade_Empresas"