Title: Message
I'm answering my own question:
 
JSR-175 is a good idea for common support by tools and compile-time checking.  This is definitely better than "write my xdoclet tags, deploy, and see if it worked".
 
Les
-----Original Message-----
From: Les Hazlewood
Sent: Wednesday, April 07, 2004 12:38 PM
To: [EMAIL PROTECTED]
Subject: RE: [Hibernate] Commit of pre-alpha Hibernate Metadata annotations (JSR-175)

What is the benefit of this over XDoclet tags?  I find the XDoclet tags already in use _much_ easier to read and understand than these....  Any reason for supporting JSR-175 other than "its cool cause now the JDK will support it"?  The only benefit I can see is that JSR-175 supports class-level or runtime-level inspection of annotations (as opposed to XDoclet's source-level inspection).  But will Hibernate ever use that level of inspection?  I suppose that once the annotations are finished and a Hibernate user is using JDK 1.5, then the benefit is that they don't need XDoclet to generate hbms.  Do you guys want to spend all the effort of supporting JSR-175 if that is the main benefit when XDoclet already does a good job?
 
Just curious...
 
Les
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Emmanuel Bernard
Sent: Wednesday, April 07, 2004 9:31 AM
To: [EMAIL PROTECTED]
Subject: Re: [Hibernate] Commit of pre-alpha Hibernate Metadata annotations (JSR-175)

Here is a simple example which widely use default values of each annotations, and thus not expressed (actually hbm does the same).

package org.hibernate.test.metadata;

// annotation import
import net.sf.hibernate.annotation.ClassAnn;
import net.sf.hibernate.annotation.IdAnn;
import net.sf.hibernate.annotation.GeneratorAnn;
import net.sf.hibernate.annotation.ParamAnn;
import net.sf.hibernate.annotation.PropertyAnn;
import net.sf.hibernate.annotation.VersionAnn;
import net.sf.hibernate.annotation.ColumnAnn;
import net.sf.hibernate.annotation.BooleanImplied;
import net.sf.hibernate.annotation.VersionUnsavedValue;
import net.sf.hibernate.annotation.CacheUsage;

/**
 * Simple annoted class wo relationship
 *
 * @author Emmanuel Bernard
 */
@ClassAnn(
    table = "SIMPLEANN",
    lazy = BooleanImplied.TRUE,
    cache = CacheUsage.None,
    batchSize = 10
)

public class SimpleWithAnn {
    /**
     * this is a field access id
     */
    @IdAnn(
        unsavedValue = "null"
        generator = @GeneratorAnn(
            className = "native",
            params = [EMAIL PROTECTED](
                name="sequence",
                value="DEFAULT_SEQ")
            }
        )
    )

    private Integer id;
    private int version;
    private String name;
   
   
    public Integer getId() {
        return id;
    }

    public void setId(Integer integer) {
        id = integer;
    }

   
/**
     * this is a property access version
     */

    @VersionAnn(
        column = @ColumnAnn(
            name = "VRSN"
        ),
        unsavedValue = VersionUnsavedValue.Negative
    )

    public int getVersion() {
        return version;
    }

    public void setVersion(int integer) {
        version = integer;
    }

    @PropertyAnn(
        columns = { @ColumnAnn(name = "SimpleName", notNull = true)
        }
    )

    public String getName() {
        return name;
    }

    public void setName(String string) {
        name = string;
    }

}



Gavin King wrote:

Fantastic :) Hey, can you show us an example of an annotated class?


Reply via email to