Package org.nutz.dao.entity.annotation

Examples of org.nutz.dao.entity.annotation.Id


    Next next = field.getAnnotation(Next.class);
    if (null != next) {
      ef.setAfterInsert(FieldQuerys.eval(db, next.value(), ef));
    }
//    @Id
    Id id = field.getAnnotation(Id.class);
    if (null != id) {
      // Check
      if (!ef.getMirror().isIntLike())
        throw error(entity, "@Id field [%s] must be a Integer!", field.getName());
      if (id.auto()) {
        ef.setType(FieldType.SERIAL);
        // 如果是自增字段,并且没有声明 '@Next' ,为其增加 SELECT MAX(id) ...
        if (null == field.getAnnotation(Next.class)) {
          ef.setAfterInsert(FieldQuerys.create("SELECT MAX($field) FROM $view", ef));
        }
View Full Code Here

TOP

Related Classes of org.nutz.dao.entity.annotation.Id

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.