Example usage for org.hibernate EntityMode parse

List of usage examples for org.hibernate EntityMode parse

Introduction

In this page you can find the example usage for org.hibernate EntityMode parse.

Prototype

public static EntityMode parse(String entityMode) 

Source Link

Document

Legacy-style entity-mode name parsing.

Usage

From source file:com.hazelcast.hibernate.serialization.Hibernate3CacheKeySerializer.java

License:Open Source License

@Override
public CacheKey read(ObjectDataInput in) throws IOException {

    try {//from  w  w  w . jav a 2 s.co  m
        Object key = in.readObject();
        Type type = in.readObject();
        String entityOrRoleName = in.readUTF();
        EntityMode entityMode = EntityMode.parse(in.readUTF());
        int hashCode = in.readInt();

        CacheKey cacheKey = (CacheKey) UNSAFE.allocateInstance(CacheKey.class);
        UNSAFE.putObjectVolatile(cacheKey, KEY_OFFSET, key);
        UNSAFE.putObjectVolatile(cacheKey, TYPE_OFFSET, type);
        UNSAFE.putObjectVolatile(cacheKey, ENTITY_OR_ROLE_NAME_OFFSET, entityOrRoleName);
        UNSAFE.putObjectVolatile(cacheKey, ENTITY_MODE_OFFSET, entityMode);
        UNSAFE.putIntVolatile(cacheKey, HASH_CODE_OFFSET, hashCode);
        return cacheKey;

    } catch (Exception e) {
        if (e instanceof IOException) {
            throw (IOException) e;
        }
        throw new IOException(e);
    }
}