All Downloads are FREE. Search and download functionalities are using the official Maven repository.

panda.dao.entity.annotation.PK Maven / Gradle / Ivy

Go to download

Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.

There is a newer version: 1.8.0
Show newest version
package panda.dao.entity.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Declare primary key。
 * 

* *

 * @Table("t_abc")
 * public class Abc {
 *   @PK
 *   int a;
 *   
 *   @PK
 *   int b;
 * ...
 * 
* *

* 这个注解主要应用在复合主键的情况,如果一个 POJO 是复合主键的话,你需要通过 *

    *
  • fetch(Class,Object ...) 来获取一个对象 *
  • delete(Class,Object ...) 来删除一个对象 *
* 变参给入的顺序,需要按照本注解声明的顺序,否则会发生不可预知的错误。 *

* 在 POJO 中,你可以同时声明 '@Id','@PK',但是 '@Id' 更优先 * */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) @Documented public @interface PK { /** * key name */ String value() default ""; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy