Example usage for javax.persistence GenerationType AUTO

List of usage examples for javax.persistence GenerationType AUTO

Introduction

In this page you can find the example usage for javax.persistence GenerationType AUTO.

Prototype

GenerationType AUTO

To view the source code for javax.persistence GenerationType AUTO.

Click Source Link

Document

Indicates that the persistence provider should pick an appropriate strategy for the particular database.

Usage

From source file:fr.xebia.demo.wicket.blog.data.Category.java

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
    return this.id;
}

From source file:com.jdom.mediadownloader.domain.User.java

/**
 * Auto-generated primary key.//from  w  w w. j ava  2 s .c  om
 * 
 * @return the id for this entity object
 */
@Override
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public int getId() {
    return id;
}

From source file:ru.apertum.qsystem.reports.model.QReport.java

@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO)
@Override
public Long getId() {
    return id;
}

From source file:com.bedatadriven.rebar.persistence.mapping.SingleColumnPropertyMapping.java

protected SingleColumnPropertyMapping(MethodInfo getterMethod) {
    super(getterMethod);

    columnName = getName();/*from  w  ww .  j a  va 2s .  com*/

    // @Id annotation makes this field an id
    id = (getterMethod.getAnnotation(Id.class) != null);

    // define default values for the column
    updatable = !id;
    unique = id;

    // @GeneratedValue(strategy = GeneratedType.Auto)
    if (id) {
        ClientSideGeneratedValue generatedValue = getterMethod.getAnnotation(ClientSideGeneratedValue.class);
        if (generatedValue != null) {
            if (generatedValue.strategy() == GenerationType.AUTO) {
                autoincrement = true;
                insertable = false;
            }
        }
    }

    // @Column annotation -  insertable, updateable etc
    Column column = getterMethod.getAnnotation(Column.class);
    if (column != null) {
        insertable = !autoincrement && column.insertable();
        updatable = !id && column.updatable();
        nullable = !id && column.nullable();
        unique = id || column.unique();

        if (column.name() != null && column.name().length() != 0) {
            columnName = column.name();
        }
    }
}

From source file:edu.txstate.dmlab.clusteringwiki.entity.ClusterEdit.java

/**
 * @return the id
 */
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
public Integer getId() {
    return id;
}

From source file:be.fedict.trust.service.entity.constraints.CertificateConstraintEntity.java

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public long getId() {
    return this.id;
}

From source file:edu.scripps.fl.pubchem.db.XRef.java

@Id
@Column(name = "xref_id")
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
    return id;
}

From source file:org.senro.demo.Category.java

/**
 * @hibernate.id generator-class="native"
 */
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
    return id;
}

From source file:com.bahadirakin.persistance.model.Customer.java

@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
    return id;
}

From source file:com.gihan.model.Payment.java

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public int getId() {
    return this.id;
}