> I'm using a database that has a compose primary key. The 
> problem is that the Xdoclet genarates a findByPrimaryKey 
> method with a 
> primary key unique automatically.
> I don't want it !
> 
> Supose my compose primary key is codeProduct+codEmploy. So 
> insted of have findByPrimaryKey(codeProduct), I'd like have only
> findByCodeEmploy(codProduct,codEmploy) to find a entity.
> 
> 
> What I have to do for don't geranate the findByPrimaryKey method.
> 
> 
> []'s

Greetings,

The remote home interface of an Entity Bean is required to declare a
findByPrimaryKey() method.  For a bean with a composite primary key, then,
you must have a findByPrimaryKey(SomeCompositeKey key) in the remote home
interface.  Thus, xdoclet must generate the findByPrimaryKey() if it is to
generate code that complies with the EJB specification.

You are free to define any additional finders that you need.  See the
@ejb.finder documentation
[http://xdoclet.sourceforge.net/tags/[EMAIL PROTECTED](0..*)] for
the syntax.  Here's an example from the xpetstore project
[http://xpetstore.sourceforge.net], an excellent example of xdoclet usage.

/**
 * @author <a href="mailto:[EMAIL PROTECTED]">Herve Tchepannou</a>
 *
 * @ejb.bean
 *      name="Customer"
 *      type="CMP"
 *      view-type="local"
 *      local-jndi-name="local/xpetstore.domain.customer.Customer"
 *      primkey-field="userId"
 *      schema="Customer"
 *      cmp-version="${ejb.cmp.version}"
 * @ejb.value-object
 *      name="Customer"
 *      match="*"
 * @ejb.transaction
 *      type="Required"
 * @ejb.util
 *      generate="physical"
 * @ejb.persistence
 *      table-name="T_CUSTOMER"
 * @ejb.finder
 *      signature="Customer findByEmail(java.lang.String email)"
 *      query="SELECT OBJECT(c) FROM Customer AS c WHERE c.email=?1"
 *
 * @jboss.persistence
 *      create-table="${jboss.create.table}"
 *      remove-table="${jboss.remove.table}"
 */
public abstract class CustomerEJB
    implements EntityBean
{
    ...
}

Good luck,
Craig


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to