Example usage for org.hibernate.type StandardBasicTypes SERIALIZABLE

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

Introduction

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

Prototype

SerializableType SERIALIZABLE

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

Click Source Link

Document

The standard Hibernate type for mapping java.io.Serializable to JDBC java.sql.Types#VARBINARY VARBINARY .

Usage

From source file:debop4k.data.orm.hibernate.HibernateParameter.java

License:Apache License

/**
 * Static constructor//  w w  w .j  av  a 2 s  .c o  m
 *
 * @param name  parameter name
 * @param value parameter value
 * @return {@link HibernateParameter} ?
 */
public static HibernateParameter of(@NonNull String name, Object value) {
    return of(name, value, StandardBasicTypes.SERIALIZABLE);
}

From source file:debop4k.data.orm.hibernate.HibernateParameter.java

License:Apache License

/**
 * Constructor//from w w  w. j av  a 2  s  .  c om
 *
 * @param name  parameter name
 * @param value parameter value
 */
public HibernateParameter(@NonNull String name, Object value) {
    this(name, value, StandardBasicTypes.SERIALIZABLE);
}

From source file:debop4k.data.orm.jpa.JapParameter.java

License:Apache License

public JapParameter(String name, Object value) {
    this(name, value, StandardBasicTypes.SERIALIZABLE);
}

From source file:junit.googlecode.genericdao.dao.hibernate.BaseDAOTest.java

License:Apache License

@Test
public void testProxyIssues() throws HibernateException, SecurityException, NoSuchMethodException {
    initDB();//  ww w. j av  a  2 s.  c  o  m
    Address address = papaA.getHome().getAddress();
    try {
        Serializable id = address.getId();

        // When working with 2 different session, the session.contains(entity) returns false
        // see in _exists(Object entity) in HibernateBaseDAO
        SessionImplementor openSession = (SessionImplementor) sessionFactory.openSession();

        Address proxy = (Address) JavassistLazyInitializer.getProxy(Address.class.getName(), Address.class,
                new Class[] { HibernateProxy.class }, Address.class.getMethod("getId"),
                Address.class.getMethod("setId", Long.class),
                new AnyType(StandardBasicTypes.LONG, StandardBasicTypes.SERIALIZABLE), id, openSession);

        // If this is not working properly, this will throw an error
        target.saveOrUpdateIsNew(proxy);

        //So will this
        Address address2 = target.get(proxy.getClass(), id);

        assertEquals("update on the proxy should work ", proxy.getCity(), address2.getCity());

    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }

}

From source file:kr.debop4j.data.hibernate.HibernateParameter.java

License:Apache License

/**
 * Instantiates a new Hibernate parameter.
 *
 * @param name  the parameter name/*w ww .jav a2s.  co m*/
 * @param value the parameter value
 */
public HibernateParameter(String name, Object value) {
    this(name, value, StandardBasicTypes.SERIALIZABLE);
}