Example usage for org.hibernate.cache.spi.entry CacheEntry isReferenceEntry

List of usage examples for org.hibernate.cache.spi.entry CacheEntry isReferenceEntry

Introduction

In this page you can find the example usage for org.hibernate.cache.spi.entry CacheEntry isReferenceEntry.

Prototype

boolean isReferenceEntry();

Source Link

Document

Does this entry represent a direct entity reference (rather than disassembled state)?

Usage

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

License:Open Source License

@Override
public void write(ObjectDataOutput out, CacheEntry object) throws IOException {

    try {/*from w  ww .  j a v a 2 s .c  o  m*/
        out.writeBoolean(object.isReferenceEntry());
        if (object.isReferenceEntry()) {
            // Reference entries are not disassembled. Instead, to be serialized, they rely entirely on
            // the entity itself being Serializable. This is not a common thing (Hibernate is currently
            // very restrictive about what can be cached by reference), so it may not be worth dealing
            // with at all. This is just a naive implementation relying on the entity's serialization.
            writeReference(out, object);
        } else {
            writeDisassembled(out, object);
        }
    } catch (Exception e) {
        throw rethrow(e);
    }
}

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

License:Open Source License

@Override
public void write(final ObjectDataOutput out, final CacheEntry object) throws IOException {

    try {/*www .j  a  v  a 2 s  . co  m*/
        out.writeBoolean(object.isReferenceEntry());
        if (object.isReferenceEntry()) {
            // Reference entries are not disassembled. Instead, to be serialized, they rely entirely on
            // the entity itself being Serializable. This is not a common thing (Hibernate is currently
            // very restrictive about what can be cached by reference), so it may not be worth dealing
            // with at all. This is just a naive implementation relying on the entity's serialization.
            writeReference(out, object);
        } else {
            writeDisassembled(out, object);
        }
    } catch (Exception e) {
        throw rethrow(e);
    }
}