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