Example usage for org.hibernate.type EnumType TYPE

List of usage examples for org.hibernate.type EnumType TYPE

Introduction

In this page you can find the example usage for org.hibernate.type EnumType TYPE.

Prototype

String TYPE

To view the source code for org.hibernate.type EnumType TYPE.

Click Source Link

Usage

From source file:com.cai310.lottery.entity.lottery.Scheme.java

/**
 * @return {@link #shareType}//from www.  ja  v a  2s.  c  o  m
 */
@Type(type = "org.hibernate.type.EnumType", parameters = {
        @Parameter(name = EnumType.ENUM, value = "com.cai310.lottery.common.ShareType"),
        @Parameter(name = EnumType.TYPE, value = ShareType.SQL_TYPE) })
@Column(nullable = false, updatable = false)
public ShareType getShareType() {
    return shareType;
}

From source file:com.cai310.lottery.entity.lottery.Scheme.java

/**
 * @return {@link #secretType}/*from w  w w . java  2 s.  c o  m*/
 */
@Type(type = "org.hibernate.type.EnumType", parameters = {
        @Parameter(name = EnumType.ENUM, value = "com.cai310.lottery.common.SecretType"),
        @Parameter(name = EnumType.TYPE, value = SecretType.SQL_TYPE) })
@Column(nullable = false)
public SecretType getSecretType() {
    return secretType;
}

From source file:com.cai310.lottery.entity.lottery.Scheme.java

/**
 * @return {@link #state}//  ww  w. ja v  a2 s .c  o  m
 */
@Type(type = "org.hibernate.type.EnumType", parameters = {
        @Parameter(name = EnumType.ENUM, value = "com.cai310.lottery.common.SchemeState"),
        @Parameter(name = EnumType.TYPE, value = SchemeState.SQL_TYPE) })
@Column(nullable = false)
public SchemeState getState() {
    return state;
}

From source file:com.cai310.lottery.entity.lottery.Scheme.java

/**
 * @return {@link #subscriptionLicenseType}
 *//*from  w ww.j a  va  2  s . c  o  m*/
@Type(type = "org.hibernate.type.EnumType", parameters = {
        @Parameter(name = EnumType.ENUM, value = "com.cai310.lottery.common.SubscriptionLicenseType"),
        @Parameter(name = EnumType.TYPE, value = SubscriptionLicenseType.SQL_TYPE) })
@Column(nullable = false)
public SubscriptionLicenseType getSubscriptionLicenseType() {
    return subscriptionLicenseType;
}

From source file:com.cai310.lottery.entity.lottery.Scheme.java

/**
 * @return {@link #winningUpdateStatus}//w  w  w  . j  av a  2 s.c om
 */
@Type(type = "org.hibernate.type.EnumType", parameters = {
        @Parameter(name = EnumType.ENUM, value = "com.cai310.lottery.common.WinningUpdateStatus"),
        @Parameter(name = EnumType.TYPE, value = WinningUpdateStatus.SQL_TYPE) })
@Column(nullable = false)
public WinningUpdateStatus getWinningUpdateStatus() {
    return winningUpdateStatus;
}

From source file:com.cai310.lottery.entity.lottery.Scheme.java

@Type(type = "org.hibernate.type.EnumType", parameters = {
        @Parameter(name = EnumType.ENUM, value = "com.cai310.lottery.common.PlatformInfo"),
        @Parameter(name = EnumType.TYPE, value = SalesMode.SQL_TYPE) })
@Column(updatable = false)/*from  ww  w.jav a 2  s.c  o  m*/
public PlatformInfo getPlatform() {
    return platform;
}

From source file:com.cai310.lottery.entity.lottery.Scheme.java

/**
 * @return {@link #mode}//www . jav a 2s.  co m
 */

@Type(type = "org.hibernate.type.EnumType", parameters = {
        @Parameter(name = EnumType.ENUM, value = "com.cai310.lottery.common.SalesMode"),
        @Parameter(name = EnumType.TYPE, value = SalesMode.SQL_TYPE) })
@Column(name = "sales_mode", nullable = false, updatable = false)
public SalesMode getMode() {
    return mode;
}

From source file:com.cai310.lottery.entity.lottery.Scheme.java

@Type(type = "org.hibernate.type.EnumType", parameters = {
        @Parameter(name = EnumType.ENUM, value = "com.cai310.lottery.common.SaleAnalyseState"),
        @Parameter(name = EnumType.TYPE, value = SalesMode.SQL_TYPE) })
@Column//from   www.  j  av  a  2 s  .c o m
public SaleAnalyseState getSaleAnalyseState() {
    return saleAnalyseState;
}

From source file:com.cai310.lottery.entity.lottery.Scheme.java

/**
 * @return the schemePrintState//from w  ww  .ja v a 2 s.  c o  m
 */
@Type(type = "org.hibernate.type.EnumType", parameters = {
        @Parameter(name = EnumType.ENUM, value = "com.cai310.lottery.common.SchemePrintState"),
        @Parameter(name = EnumType.TYPE, value = SchemeState.SQL_TYPE) })
@Column(nullable = false)
public SchemePrintState getSchemePrintState() {
    return schemePrintState;
}

From source file:org.grails.orm.hibernate.cfg.GrailsDomainBinder.java

License:Apache License

protected void bindEnumType(PersistentProperty property, Class<?> propertyType, SimpleValue simpleValue,
        String columnName) {//  w ww .  j  av  a2s. c  om

    PropertyConfig pc = getPropertyConfig(property);
    final PersistentEntity owner = property.getOwner();
    String typeName = getTypeName(property, getPropertyConfig(property), getMapping(owner));
    if (typeName == null) {
        Properties enumProperties = new Properties();
        enumProperties.put(ENUM_CLASS_PROP, propertyType.getName());

        String enumType = pc == null ? DEFAULT_ENUM_TYPE : pc.getEnumType();
        boolean isDefaultEnumType = enumType.equals(DEFAULT_ENUM_TYPE);
        simpleValue.setTypeName(ENUM_TYPE_CLASS);
        if (isDefaultEnumType || "string".equalsIgnoreCase(enumType)) {
            enumProperties.put(EnumType.TYPE, String.valueOf(Types.VARCHAR));
            enumProperties.put(EnumType.NAMED, Boolean.TRUE.toString());
        } else if ("identity".equals(enumType)) {
            simpleValue.setTypeName(HibernateUtils.buildIdentityEnumTypeFactory().getName());
        } else if (!"ordinal".equalsIgnoreCase(enumType)) {
            simpleValue.setTypeName(enumType);
        }
        simpleValue.setTypeParameters(enumProperties);
    } else {
        simpleValue.setTypeName(typeName);
    }

    Table t = simpleValue.getTable();
    Column column = new Column();

    if (owner.isRoot()) {
        column.setNullable(property.isNullable());
    } else {
        Mapping mapping = getMapping(owner);
        if (mapping == null || mapping.getTablePerHierarchy()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("[GrailsDomainBinder] Sub class property [" + property.getName()
                        + "] for column name [" + column.getName() + "] set to nullable");
            }
            column.setNullable(true);
        } else {
            column.setNullable(property.isNullable());
        }
    }
    column.setValue(simpleValue);
    column.setName(columnName);
    if (t != null)
        t.addColumn(column);

    simpleValue.addColumn(column);

    PropertyConfig propertyConfig = getPropertyConfig(property);
    if (propertyConfig != null && !propertyConfig.getColumns().isEmpty()) {
        bindIndex(columnName, column, propertyConfig.getColumns().get(0), t);
        bindColumnConfigToColumn(property, column, propertyConfig.getColumns().get(0));
    }
}