[@Entity]
必须与@Id注解 结合使用
否则 No identifier specified for entity:
name 属性
(可选)实体名称。 缺省为实体类的非限定名称。
该名称用于引用查询中的实体。
该名称不能是Java持久性查询语言中的保留字面值。
不与@Table结合的话 表名 默认为 SnakeCaseStrategy(命名策略 )为表名
若使用 name属性 且没有与@Table结合 则表名为 name值的SnakeCaseStrategy(命名策略 )
例如:
@Entity
public class UserEntity{...} 表名 user_entity
@Entity(name="UE")
public class UserEntity{...} 表名 ue
@Entity(name="UsEntity")
public class UserEntity{...} 表名 us_entity
package sun.rain.amazing.javax.anno.domain;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author sunRainAmazing */
@Entity
@Data
public class UserEntity {
/**
* No identifier specified for entity: sun.rain.amazing.javax.anno.domain.UserEntity
*/
@Id
private int id;
private String username;
private String email;
public UserEntity(String username, String email) {
this.username = username;
this.email = email;
}
public UserEntity() {
}
}