javax.persistence.Access类的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(385)

本文整理了Java中javax.persistence.Access类的一些代码示例,展示了Access类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Access类的具体详情如下:
包路径:javax.persistence.Access
类名称:Access

Access介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Entity(name = "Address")
@Table(name = "ADDRESS")
@Access(AccessType.FIELD)
public static class Address {
  @Id
  @Column(name = "ID", nullable = false)
  @SequenceGenerator(name = "ID", sequenceName = "ADDRESS_SEQ")
  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ID")
  private Long id;
}

代码示例来源:origin: hibernate/hibernate-orm

private static AccessType getAccessTypeOrNull(AnnotatedElement element) {
  if ( element == null ) {
    return null;
  }
  Access elementAccess = element.getAnnotation( Access.class );
  return elementAccess == null ? null : elementAccess.value();
}

代码示例来源:origin: mercyblitz/segmentfault-lessons

@Entity
@Access(value = AccessType.FIELD)
@Table(name = "customers")
@EntityListeners(value = {CustomerListener.class})
public class Customer {

代码示例来源:origin: hibernate/hibernate-orm

@Entity
@Access(AccessType.FIELD)
public class BaseEntity {
  @Id
  @SequenceGenerator(name = "test1_id_gen", sequenceName = "test1_seq")
  @GeneratedValue(generator = "test1_id_gen", strategy = GenerationType.SEQUENCE)
  protected Integer id;

  protected String name;

  public BaseEntity() {
  }

  public Integer getId() {
    return id;
  }

  public String getName() {
    return name;
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Entity
@Access(AccessType.FIELD)
public class SubA extends NormalExtendsEntity {
  protected String street;

  public String getStreet() {
    return street;
  }
}

代码示例来源:origin: MissionCriticalCloud/cosmic

@Access(AccessType.PROPERTY)
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
public long getId() {
  return super.getId();
}

代码示例来源:origin: hibernate/hibernate-orm

@Entity(name = "SpecialPerson")
  @Access(AccessType.FIELD)
  @DiscriminatorValue("2")
  public static class SpecialPerson extends Person {
    @Column(name = "special")
    private String special;
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Access( AccessType.PROPERTY)
@Id
@GeneratedValue
public long getId() {
  return id;
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testAllAttributes() throws Exception {
  reader = getReader( Entity1.class, "field1", "many-to-one.orm6.xml" );
  assertAnnotationPresent( ManyToOne.class );
  assertAnnotationNotPresent( JoinColumn.class );
  assertAnnotationNotPresent( JoinColumns.class );
  assertAnnotationNotPresent( JoinTable.class );
  assertAnnotationPresent( Id.class );
  assertAnnotationPresent( MapsId.class );
  assertAnnotationPresent( Access.class );
  ManyToOne relAnno = reader.getAnnotation( ManyToOne.class );
  assertEquals( 0, relAnno.cascade().length );
  assertEquals( FetchType.LAZY, relAnno.fetch() );
  assertFalse( relAnno.optional() );
  assertEquals( Entity3.class, relAnno.targetEntity() );
  assertEquals( "col1", reader.getAnnotation( MapsId.class ).value() );
  assertEquals(
      AccessType.PROPERTY, reader.getAnnotation( Access.class )
      .value()
  );
}

代码示例来源:origin: hibernate/hibernate-orm

@Access(javax.persistence.AccessType.FIELD)
public long getFloors() {
  return this.floors + 2;
}

代码示例来源:origin: minnal/minnal

/**
 * @author ganeshs
 *
 */
@Entity
@Table(name="specialties")
@Access(AccessType.FIELD)
public class Specialty extends NamedEntity {

}

代码示例来源:origin: hibernate/hibernate-orm

@Entity
@Access(AccessType.PROPERTY)
public class Course4 {
  @Id
  @GeneratedValue
  private long id;

代码示例来源:origin: hibernate/hibernate-orm

@Entity
@Access(AccessType.FIELD)
public class SubB extends NormalExtendsMapped {
  protected String street;

  public String getStreet() {
    return street;
  }
}

代码示例来源:origin: io.github.toquery/clever-framework-dao

/**
 * 定义主键为Long类型,指定主键生成规则
 */
@Setter
@Getter
@MappedSuperclass
@Access(AccessType.FIELD)
@EqualsAndHashCode(callSuper = true)
public class AppBaseEntityPrimaryKeyLong extends AppBaseEntity {

  @Id
  @Column
  @GeneratedValue(generator = "generatedkey")
  @GenericGenerator(name = "generatedkey", strategy = "io.github.toquery.framework.dao.primary.generator.AppJpaEntityLongIDGenerator")
  protected Long id;

}

代码示例来源:origin: hibernate/hibernate-orm

@Entity(name = "SpecialPerson")
  @Access(AccessType.FIELD)
  @DiscriminatorValue("2")
  public static class SpecialPerson extends Person {
    @Column(name = "special")
    private String special;
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Id
  @Access(AccessType.PROPERTY)
  @Override
  public Long getUid() {
    return super.getUid();
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Access(AccessType.FIELD)
@Embeddable
public static class Emb {
  @OneToMany(targetEntity = Stuff.class)
  Set<Stuff> stuffs = new HashSet<Stuff>();
  @Entity
  @Table(name = "stuff")
  public static class Stuff {
    @Id
    private Long id;
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Entity(name = "Address")
@Table(name = "ADDRESS")
@Access(AccessType.FIELD)
public static class Address {
  @Id
  @Column(name = "ID", nullable = false)
  @SequenceGenerator(name = "ID", sequenceName = "ADDRESS_SEQ")
  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ID")
  private Long id;
}

代码示例来源:origin: minnal/minnal

/**
 * @author ganeshs
 *
 */
@Entity
@Table(name="types")
@Access(AccessType.FIELD)
@AggregateRoot
public class PetType extends NamedEntity {

}

代码示例来源:origin: hibernate/hibernate-orm

@Entity
@Access(AccessType.FIELD)
public class Location {
  @Id
  private long id;
  private String description;

相关文章