org.hibernate.annotations.Cascade类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(209)

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

Cascade介绍

暂无

代码示例

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

@Entity
  @Table( name = "FOO" )
  private static class Foo {

    @Id
    @GeneratedValue
    Long id;

    @OneToMany( orphanRemoval = true, mappedBy = "foo", targetEntity = Bar.class )
    @Cascade( CascadeType.ALL )
    Set<Bar> bars = new HashSet<>();
  }
}

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

CascadeType[] hibernateCascades = hibernateCascadeAnnotation == null ?
    null :
    hibernateCascadeAnnotation.value();

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

@OneToMany(targetEntity = org.hibernate.test.annotations.Discount.class,
    cascade = CascadeType.ALL, mappedBy = "owner")
@Cascade({ALL})
public Collection getDiscountTickets() {
  return discountTickets;
}

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

@ManyToAny(
    metaColumn = @Column( name = "property_type" ) )
@AnyMetaDef( idType = "integer", metaType = "string",
    metaValues = {
    @MetaValue( value = "S", targetEntity = StringProperty.class ),
    @MetaValue( value = "I", targetEntity = IntegerProperty.class ) } )
@Cascade( { org.hibernate.annotations.CascadeType.ALL } )
@JoinTable( name = "obj_properties", joinColumns = @JoinColumn( name = "obj_id" ),
    inverseJoinColumns = @JoinColumn( name = "property_id" ) )
public List<Property> getGeneralProperties() {
  return generalProperties;
}

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

@ManyToMany(
    cascade = {CascadeType.PERSIST, CascadeType.MERGE},
    mappedBy = "employees"
)
@Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE,
    org.hibernate.annotations.CascadeType.PERSIST})
public Collection<Employer> getEmployers() {
  return employers;
}

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

@OneToMany(mappedBy = "mother")
@Cascade({ CascadeType.SAVE_UPDATE })
public Set<Son> getSons() { return sons; }
public void setSons(Set<Son> sons) {  this.sons = sons; }

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

@Any( metaColumn = @Column( name = "property_type" ) )
@Cascade( value = { CascadeType.ALL } )
@AnyMetaDef( idType = "integer", metaType = "string", metaValues = {
@MetaValue( value = "S", targetEntity = StringProperty.class ),
@MetaValue( value = "I", targetEntity = IntegerProperty.class )
    } )
@JoinColumn( name = "property_id" )
public Property getSomeProperty() {
  return someProperty;
}

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

@ManyToOne(fetch = FetchType.LAZY)
@Cascade(CascadeType.ALL)
public SideEntity getSubField() {
  return subField;
}

代码示例来源:origin: shopizer-ecommerce/shopizer

@Entity
@EntityListeners(value = AuditListener.class)
@Table(name = "PERMISSION", schema=SchemaConstant.SALESMANAGER_SCHEMA)
public class Permission extends SalesManagerEntity<Integer, Permission> implements Auditable {
  @Id
  @Column(name = "PERMISSION_ID", unique=true, nullable=false)
  @TableGenerator(name = "TABLE_GEN", table = "SM_SEQUENCER", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "PERMISSION_SEQ_NEXT_VAL")
  @GeneratedValue(strategy = GenerationType.TABLE, generator = "TABLE_GEN")
  private Integer id;
  @Column(name="PERMISSION_NAME", unique=true)
  private String permissionName;
          nullable = false, updatable = false) }
  @Cascade({
    org.hibernate.annotations.CascadeType.DETACH,
    org.hibernate.annotations.CascadeType.LOCK,

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

@OneToMany
@OrderColumn(name = "son_arriv")
@JoinColumn(name = "father_id", nullable = false)
@Cascade({ CascadeType.SAVE_UPDATE })
public List<Son> getOrderedSons() { return orderedSons; }
public void setOrderedSons(List<Son> orderedSons) {  this.orderedSons = orderedSons; }

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

@Any( metaColumn = @Column( name = "property_type" ), fetch = FetchType.LAZY )
@Cascade( value = { CascadeType.ALL } )
@AnyMetaDef( idType = "integer", metaType = "string", metaValues = {
@MetaValue( value = "S", targetEntity = StringProperty.class ),
@MetaValue( value = "I", targetEntity = IntegerProperty.class )
    } )
@JoinColumn( name = "property_id" )
public Property getSomeProperty() {
  return someProperty;
}

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

@ManyToMany(
    targetEntity = org.hibernate.test.annotations.manytomany.Contractor.class,
    cascade = {CascadeType.PERSIST, CascadeType.MERGE}
)
@JoinTable(
    name = "EMPLOYER_CONTRACTOR",
    joinColumns = {@JoinColumn(name = "EMPLOYER_ID")},
    inverseJoinColumns = {@JoinColumn(name = "CONTRACTOR_ID")}
)
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@OrderBy("name desc")	
public List getContractors() {
  return contractors;
}

代码示例来源:origin: org.hibernate/hibernate-annotations

CascadeType[] hibernateCascades = hibernateCascadeAnnotation == null ?
    null :
    hibernateCascadeAnnotation.value();

代码示例来源:origin: shopizer-ecommerce/shopizer

private AuditSection auditSection = new AuditSection();
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "product")
private Set<ProductDescription> descriptions = new HashSet<ProductDescription>();
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy="product")
private Set<ProductAvailability> availabilities = new HashSet<ProductAvailability>();
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "product")
private Set<ProductAttribute> attributes = new HashSet<ProductAttribute>();
        nullable = false, updatable = false) }
@Cascade({
  org.hibernate.annotations.CascadeType.DETACH,
  org.hibernate.annotations.CascadeType.LOCK,
private Set<Category> categories = new HashSet<Category>();
@Column(name="DATE_AVAILABLE")
@Temporal(TemporalType.TIMESTAMP)
private Date dateAvailable = new Date();
@Column(name="AVAILABLE")
private boolean available = true;

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

@OneToMany( mappedBy = "user",
      cascade = {CascadeType.PERSIST,
            CascadeType.MERGE,
            CascadeType.REMOVE,
            CascadeType.REFRESH},
      fetch = FetchType.EAGER, orphanRemoval = true)
@Cascade( value = org.hibernate.annotations.CascadeType.SAVE_UPDATE )
public Collection<Preference> getPreferences() {
  return preferences;
}

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

@ManyToAny( metaColumn = @Column( name = "property_type" ) )
@AnyMetaDef(
    idType = "integer", metaType = "string",
    metaValues = {
    @MetaValue( value = "S", targetEntity = StringProperty.class ),
    @MetaValue( value = "I", targetEntity = IntegerProperty.class ) } )
@Cascade( org.hibernate.annotations.CascadeType.ALL )
@JoinTable(
    name = "map_properties",
    joinColumns = @JoinColumn( name = "map_id" ),
    inverseJoinColumns = @JoinColumn( name = "property_id" ) )
@MapKeyColumn( name = "map_key", nullable = false )   //keep for legacy test
public Map<String, Property> getProperties() {
  return properties;
}

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

@ManyToMany(
    targetEntity = org.hibernate.test.annotations.manytomany.Employee.class,
    cascade = {CascadeType.PERSIST, CascadeType.MERGE}
)
@JoinTable(
    name = "EMPLOYER_EMPLOYEE",
    joinColumns = {@JoinColumn(name = "EMPER_ID")},
    inverseJoinColumns = {@JoinColumn(name = "EMPEE_ID")}
)
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@OrderBy("name asc")
public Collection getEmployees() {
  return employees;
}

代码示例来源:origin: shopizer-ecommerce/shopizer

@Entity
@EntityListeners(value = AuditListener.class)
@Table(name = "USER", schema=SchemaConstant.SALESMANAGER_SCHEMA)
public class User extends SalesManagerEntity<Long, User> implements Auditable {
  @Id
  @Column(name = "USER_ID", unique=true, nullable=false)
  @TableGenerator(name = "TABLE_GEN", table = "SM_SEQUENCER", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "USER_SEQ_NEXT_VAL")
  @GeneratedValue(strategy = GenerationType.TABLE, generator = "TABLE_GEN")
  private Long id;
  @Column(name="ADMIN_NAME", length=100, unique=true)
  private String adminName;
          nullable = false, updatable = false) }
  @Cascade({
    org.hibernate.annotations.CascadeType.DETACH,
    org.hibernate.annotations.CascadeType.LOCK,
  @Column(name="ADMIN_EMAIL")
  private String adminEmail;

代码示例来源:origin: denimgroup/threadfix

@OneToMany(mappedBy = "scanRepeatFindingMap")
@Cascade({ org.hibernate.annotations.CascadeType.ALL })
@JsonIgnore
public List<StatisticsCounter> getStatisticsCounters() {
  return statisticsCounters;
}

代码示例来源:origin: uk.ac.ebi.intact/intact-core

@ManyToMany( cascade = CascadeType.PERSIST)
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@JoinTable(
    name = "ia_int2annot",
    joinColumns = {@JoinColumn( name = "interactor_ac" )},
    inverseJoinColumns = {@JoinColumn( name = "annotation_ac" )}
)
@Override
public Collection<Annotation> getAnnotations() {
  return super.getAnnotations();
}

相关文章