Example usage for org.hibernate.type StandardBasicTypes LONG

List of usage examples for org.hibernate.type StandardBasicTypes LONG

Introduction

In this page you can find the example usage for org.hibernate.type StandardBasicTypes LONG.

Prototype

LongType LONG

To view the source code for org.hibernate.type StandardBasicTypes LONG.

Click Source Link

Document

The standard Hibernate type for mapping Long to JDBC java.sql.Types#BIGINT BIGINT .

Usage

From source file:org.jadira.usertype.spi.shared.AbstractLongColumnMapper.java

License:Apache License

public final LongType getHibernateType() {
    return StandardBasicTypes.LONG;
}

From source file:org.joda.time.contrib.hibernate.PersistentDateTimeAsBigInt.java

License:Apache License

public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
        throws HibernateException, SQLException {
    Object value = StandardBasicTypes.LONG.nullSafeGet(rs, names[0], session, owner);
    if (value == null) {
        return null;
    }/*from   w  w w . j a va  2  s.  c om*/
    return new DateTime(value);
}

From source file:org.joda.time.contrib.hibernate.PersistentDateTimeAsBigInt.java

License:Apache License

public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session)
        throws HibernateException, SQLException {
    if (value == null) {
        StandardBasicTypes.LONG.nullSafeSet(statement, null, index, session);
    } else {//from  w ww.  j  av  a2 s.  c o  m
        StandardBasicTypes.LONG.nullSafeSet(statement, new Long(((DateTime) value).getMillis()), index,
                session);
    }
}

From source file:org.joda.time.contrib.hibernate.PersistentInstantAsBigInt.java

License:Apache License

public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
        throws HibernateException, SQLException {
    Object value = StandardBasicTypes.LONG.nullSafeGet(rs, names[0], session, owner);
    if (value == null) {
        return null;
    }// w  ww. j  a  v  a  2s  .  co m
    return new Instant(value);
}

From source file:org.joda.time.contrib.hibernate.PersistentInstantAsBigInt.java

License:Apache License

public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session)
        throws HibernateException, SQLException {
    if (value == null) {
        StandardBasicTypes.LONG.nullSafeSet(statement, null, index, session);
    } else {//from  w w  w. j  a  va 2s .  c  o m
        StandardBasicTypes.LONG.nullSafeSet(statement, new Long(((Instant) value).getMillis()), index, session);
    }
}

From source file:org.kuali.rice.core.framework.persistence.jpa.type.HibernateKualiIntegerFieldType.java

License:Educational Community License

/**
 * This overridden method .../*from   www  .  jav  a2  s .c  o m*/
 * 
 * @see HibernateImmutableValueUserType#nullSafeGet(java.sql.ResultSet, java.lang.String[], java.lang.Object)
 */
@Override
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {

    Object source = StandardBasicTypes.LONG.nullSafeGet(rs, names[0]);
    Object converted = null;

    if ((Long) source instanceof Long) {
        converted = new KualiInteger(((Long) source).longValue());
    }
    return converted;
}

From source file:org.olat.core.util.coordinate.DBPersistentLockManager.java

License:Apache License

/**
 * Delete all persisting-locks for certain identity.
 * @see org.olat.user.UserDataDeletable#deleteUserData(org.olat.core.id.Identity)
 *//*from   w ww.ja v a2s. c om*/
public void deleteUserData(Identity identity, String newDeletedUserName) {
    String query = "from v in class org.olat.properties.Property where v.category = ? and v.longValue = ?";
    DBFactory.getInstance().delete(query, new Object[] { CATEGORY_PERSISTENTLOCK, identity.getKey() },
            new Type[] { StandardBasicTypes.STRING, StandardBasicTypes.LONG });
    log.debug("All db-persisting-locks deleted for identity=" + identity);
}

From source file:org.openbravo.base.session.OBDB2v97Dialect.java

License:Open Source License

public OBDB2v97Dialect() {
    super();//w  w  w.j  a va  2 s .  c o m

    registerHibernateType(Types.NUMERIC, StandardBasicTypes.LONG.getName());

    // registerColumnType(Types.VARCHAR, 4000, "nvarchar2($l)");
    registerColumnType(Types.VARCHAR, 100, "varchar2($l)");
    registerColumnType(Types.VARCHAR, 5, "char($l)");

    log.debug("Created Openbravo specific db2 Dialect");
}

From source file:org.openbravo.base.session.OBOracle10gDialect.java

License:Open Source License

public OBOracle10gDialect() {
    super();/*ww  w .j av a2 s.  com*/

    registerHibernateType(Types.NUMERIC, StandardBasicTypes.LONG.getName());
    registerHibernateType(Types.NVARCHAR, StandardBasicTypes.STRING.getName());
    registerHibernateType(Types.NCHAR, StandardBasicTypes.STRING.getName());

    registerColumnType(Types.VARCHAR, 4000, "nvarchar2($l)");
    registerColumnType(Types.VARCHAR, 100, "varchar2($l)");
    registerColumnType(Types.VARCHAR, 5, "char($l)");
    registerFunction("to_number", new StandardSQLFunction("to_number", StandardBasicTypes.BIG_DECIMAL));

    log.debug("Created Openbravo specific Oracle DIalect");
}

From source file:org.optaplanner.persistence.jpa.impl.score.buildin.bendablelong.BendableLongScoreHibernateType.java

License:Apache License

@Override
public void setParameterValues(Properties parameterMap) {
    int hardLevelsSize = extractIntParameter(parameterMap, "hardLevelsSize");
    int softLevelsSize = extractIntParameter(parameterMap, "softLevelsSize");
    scoreDefinition = new BendableLongScoreDefinition(hardLevelsSize, softLevelsSize);
    type = StandardBasicTypes.LONG;
}