org.hibernate.annotations.TypeDef.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(131)

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

TypeDef.<init>介绍

暂无

代码示例

代码示例来源:origin: kiegroup/optaplanner

@Entity
@TypeDef(defaultForType = SimpleDoubleScore.class, typeClass = SimpleDoubleScoreHibernateType.class)
public static class TestJpaEntity extends AbstractTestJpaEntity<SimpleDoubleScore> {
  protected SimpleDoubleScore score;
  private TestJpaEntity() {
  }
  public TestJpaEntity(SimpleDoubleScore score) {
    this.score = score;
  }
  @Override
  @Columns(columns = {@Column(name = "initScore"), @Column(name = "score")})
  public SimpleDoubleScore getScore() {
    return score;
  }
  @Override
  public void setScore(SimpleDoubleScore score) {
    this.score = score;
  }
}

代码示例来源:origin: kiegroup/optaplanner

@Entity
@TypeDef(defaultForType = HardSoftDoubleScore.class, typeClass = HardSoftDoubleScoreHibernateType.class)
public static class TestJpaEntity extends AbstractTestJpaEntity<HardSoftDoubleScore> {
  protected HardSoftDoubleScore score;
  private TestJpaEntity() {
  }
  public TestJpaEntity(HardSoftDoubleScore score) {
    this.score = score;
  }
  @Override
  @Columns(columns = {@Column(name = "initScore"), @Column(name = "hardScore"), @Column(name = "softScore")})
  public HardSoftDoubleScore getScore() {
    return score;
  }
  @Override
  public void setScore(HardSoftDoubleScore score) {
    this.score = score;
  }
}

代码示例来源:origin: kiegroup/optaplanner

@Entity
@TypeDef(defaultForType = HardSoftLongScore.class, typeClass = HardSoftLongScoreHibernateType.class)
public static class TestJpaEntity extends AbstractTestJpaEntity<HardSoftLongScore> {
  protected HardSoftLongScore score;
  private TestJpaEntity() {
  }
  public TestJpaEntity(HardSoftLongScore score) {
    this.score = score;
  }
  @Override
  @Columns(columns = {@Column(name = "initScore"), @Column(name = "hardScore"), @Column(name = "softScore")})
  public HardSoftLongScore getScore() {
    return score;
  }
  @Override
  public void setScore(HardSoftLongScore score) {
    this.score = score;
  }
}

代码示例来源:origin: kiegroup/optaplanner

@Entity
@TypeDef(defaultForType = SimpleLongScore.class, typeClass = SimpleLongScoreHibernateType.class)
public static class TestJpaEntity extends AbstractTestJpaEntity<SimpleLongScore> {
  protected SimpleLongScore score;
  private TestJpaEntity() {
  }
  public TestJpaEntity(SimpleLongScore score) {
    this.score = score;
  }
  @Override
  @Columns(columns = {@Column(name = "initScore"), @Column(name = "score")})
  public SimpleLongScore getScore() {
    return score;
  }
  @Override
  public void setScore(SimpleLongScore score) {
    this.score = score;
  }
}

代码示例来源:origin: kiegroup/optaplanner

@Entity
@TypeDef(defaultForType = HardSoftScore.class, typeClass = HardSoftScoreHibernateType.class)
public static class TestJpaEntity extends AbstractTestJpaEntity<HardSoftScore> {
  protected HardSoftScore score;
  private TestJpaEntity() {
  }
  public TestJpaEntity(HardSoftScore score) {
    this.score = score;
  }
  @Override
  @Columns(columns = {@Column(name = "initScore"), @Column(name = "hardScore"), @Column(name = "softScore")})
  public HardSoftScore getScore() {
    return score;
  }
  @Override
  public void setScore(HardSoftScore score) {
    this.score = score;
  }
}

代码示例来源:origin: kiegroup/optaplanner

@Entity
@TypeDef(defaultForType = SimpleBigDecimalScore.class, typeClass = SimpleBigDecimalScoreHibernateType.class)
public static class TestJpaEntity extends AbstractTestJpaEntity<SimpleBigDecimalScore> {
  protected SimpleBigDecimalScore score;
  private TestJpaEntity() {
  }
  public TestJpaEntity(SimpleBigDecimalScore score) {
    this.score = score;
  }
  @Override
  @Columns(columns = {@Column(name = "initScore"), @Column(name = "score", precision = 10, scale = 5)})
  public SimpleBigDecimalScore getScore() {
    return score;
  }
  @Override
  public void setScore(SimpleBigDecimalScore score) {
    this.score = score;
  }
}

代码示例来源:origin: kiegroup/optaplanner

@Entity
@TypeDef(defaultForType = SimpleScore.class, typeClass = SimpleScoreHibernateType.class)
public static class TestJpaEntity extends AbstractTestJpaEntity<SimpleScore> {
  protected SimpleScore score;
  private TestJpaEntity() {
  }
  public TestJpaEntity(SimpleScore score) {
    this.score = score;
  }
  @Override
  @Columns(columns = {@Column(name = "initScore"), @Column(name = "score")})
  public SimpleScore getScore() {
    return score;
  }
  @Override
  public void setScore(SimpleScore score) {
    this.score = score;
  }
}

代码示例来源:origin: kiegroup/optaplanner

@Entity
@TypeDef(defaultForType = HardMediumSoftLongScore.class, typeClass = HardMediumSoftLongScoreHibernateType.class)
public static class TestJpaEntity extends AbstractTestJpaEntity<HardMediumSoftLongScore> {
  protected HardMediumSoftLongScore score;
  private TestJpaEntity() {
  }
  public TestJpaEntity(HardMediumSoftLongScore score) {
    this.score = score;
  }
  @Override
  @Columns(columns = {@Column(name = "initScore"),
      @Column(name = "hardScore"), @Column(name = "mediumScore"), @Column(name = "softScore")})
  public HardMediumSoftLongScore getScore() {
    return score;
  }
  @Override
  public void setScore(HardMediumSoftLongScore score) {
    this.score = score;
  }
}

代码示例来源:origin: kiegroup/optaplanner

@Entity
@TypeDef(defaultForType = HardMediumSoftScore.class, typeClass = HardMediumSoftScoreHibernateType.class)
public static class TestJpaEntity extends AbstractTestJpaEntity<HardMediumSoftScore> {
  protected HardMediumSoftScore score;
  private TestJpaEntity() {
  }
  public TestJpaEntity(HardMediumSoftScore score) {
    this.score = score;
  }
  @Override
  @Columns(columns = {@Column(name = "initScore"),
      @Column(name = "hardScore"), @Column(name = "mediumScore"), @Column(name = "softScore")})
  public HardMediumSoftScore getScore() {
    return score;
  }
  @Override
  public void setScore(HardMediumSoftScore score) {
    this.score = score;
  }
}

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

@Entity(name = "Product")
@TypeDef(
  name = "bitset",
  defaultForType = BitSet.class,
  typeClass = BitSetType.class
)
public static class Product {
  @Id
  private Integer id;
  private BitSet bitSet;
  //Getters and setters are omitted for brevity
//end::basic-custom-type-BitSetTypeDef-mapping-example[]
  public Integer getId() {
    return id;
  }
  public void setId(Integer id) {
    this.id = id;
  }
  public BitSet getBitSet() {
    return bitSet;
  }
  public void setBitSet(BitSet bitSet) {
    this.bitSet = bitSet;
  }
//tag::basic-custom-type-BitSetTypeDef-mapping-example[]
}
//end::basic-custom-type-BitSetTypeDef-mapping-example[]

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

/**
 * @author Vlad Mihalcea
 */
@Entity(name = "Person")
@TypeDef( name = "comma_delimited_strings", typeClass = CommaDelimitedStringsType.class)
public class PersonPhone {

  @Id
  private Long id;

  @Type(type = "comma_delimited_strings")
  private List<Phone> phones = new ArrayList<>();

  public List<Phone> getPhones() {
    return phones;
  }
}

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

/**
 * @author Vlad Mihalcea
 */
@Entity(name = "Person")
@TypeDef( name = "comma_delimited_strings", typeClass = CommaDelimitedStringsType.class)
public class Person {

  @Id
  private Long id;

  @Type(type = "comma_delimited_strings")
  private List<String> phones = new ArrayList<>();

  public List<String> getPhones() {
    return phones;
  }
}

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

/**
 * @author Vlad Mihalcea
 */
@Entity(name = "Person")
@TypeDef( name = "comma_delimited_string_map", typeClass = CommaDelimitedStringsMapType.class)
public class PhoneBook {

  @Id
  private Long id;

  @Type(type = "comma_delimited_string_map")
  private Map<String, String> phones = new HashMap<>();

  public Map<String, String> getPhones() {
    return phones;
  }
}

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

@TypeDef(name = "ipv4", typeClass = InetType.class, defaultForType = Inet.class)
public class Event {

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

@TypeDef(
    name = "definedInDerivedClass",
    typeClass = CasterStringType.class,
    parameters = {
      @Parameter(name = "cast", value = "upper")
    }
)

/**
 * Defines a custom type that is used in the 
 * base class. 
 * @author Sharath Reddy
 *
 */
@Entity
public class Peugot extends Car {

}

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

@TypeDef(
    name = "customId",
    typeClass = CustomIdType.class
)
@Entity
@Table(name = "some_entity")
public static class SomeEntity {
  @Id
  @Type(type = "customId")
  @Column(name = "id")
  private CustomId customId;
  public CustomId getCustomId() {
    return customId;
  }
  public void setCustomId(final CustomId customId) {
    this.customId = customId;
  }
}

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

@TypeDef(
    name = "upperCase",
    typeClass = CasterStringType.class,
    parameters = {
      @Parameter(name = "cast", value = "upper")
    }
)

@Embeddable
public class LastName {
  
  @Type(type="upperCase")
  private String lastName;

  public String getName() {
    return lastName;
  }

  public void setName(String lowerCaseName) {
    this.lastName = lowerCaseName;
  }
  
  
}

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

@TypeDef(
    name = "lowerCase",
    typeClass = CasterStringType.class,
    parameters = {
      @Parameter(name = "cast", value = "lower")
    }
)

@MappedSuperclass
public class FirstName {

  @Type(type="lowerCase")
  private String firstName;

  public String getFirstName() {
    return firstName;
  }

  public void setFirstName(String lowerCaseName) {
    this.firstName = lowerCaseName;
  }
  
  
}

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

@TypeDef(name = "comp", typeClass = CompositeTestUserType.class)
public class CompositeCustomTypeSetEntity {

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

/**
 * @author Janario Oliveira
 */
@Entity
@TypeDef(typeClass = LastNumberType.class, defaultForType = LastNumber.class)
public class EntityMapEnum {
  @Id
  @GeneratedValue
  int id;

  @ElementCollection
  Map<Common, String> ordinalMap = new HashMap<Common, String>();
  @ElementCollection
  @MapKeyEnumerated(EnumType.STRING)
  Map<Common, String> stringMap = new HashMap<Common, String>();
  @ElementCollection
  @MapKeyType(@Type(type = "org.hibernate.test.annotations.enumerated.custom_types.FirstLetterType"))
  Map<FirstLetter, String> firstLetterMap = new HashMap<FirstLetter, String>();
  @ElementCollection
  Map<LastNumber, String> lastNumberMap = new HashMap<LastNumber, String>();
  @MapKeyEnumerated(EnumType.STRING)
  @ElementCollection
  @CollectionTable(name = "overridingMap")
  @MapKeyColumn(name = "overridingMap_key")
  Map<LastNumber, String> explicitOverridingImplicitMap = new HashMap<LastNumber, String>();
}

相关文章