> -----Original Message-----
> From: Jordi Valldaura i Riqu� [mailto:[EMAIL PROTECTED]]
> Subject: [Xdoclet-user] Any plans to support auto increment fields for
> jboss???
> 
> Hello,
> 
> I'm redeveloping a part of my universtiy's intranet, many 
> tables in the database have auto increment fields and I
> can't change them. I've read in jboss forums that there is
> a way to handle auto increment fields but it isn't in
> xdoclet. Are there any plans to Integate it???

It is in XDoclet.  You have to do a couple of things.

At the class level, you must specify the @jboss.entity-command tag.

/**
 *
 * @jboss.entity-command name="get-generated-keys"
 */
public abstract class MyBean
  implements EntityBean
{
  ...
}

'name' specifies an <entity-command> element.  'get-generated-keys' is the
JDK 1.4+ JDBC 3.0 version.  There are others like 'mysql-get-generated-keys'
if you need to use JDK 1.3 and JDBC 2.0.

Next, you must specify the @jboss.persistence tag with the auto-increment
attribute set to 'true' on your persistent fields.

  /**
   * @ejb.persistence
   *
   * @jboss.persistence auto-increment="true"
   */
  public abstract Integer getId();

That should do it.  This code is in HEAD and it might be in beta1.  If beta2
is out, it is definitely there.

Michael


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