Example usage for javax.persistence EntityManager hashCode

List of usage examples for javax.persistence EntityManager hashCode

Introduction

In this page you can find the example usage for javax.persistence EntityManager hashCode.

Prototype

@HotSpotIntrinsicCandidate
public native int hashCode();

Source Link

Document

Returns a hash code value for the object.

Usage

From source file:com.github.fharms.camel.route.CamelEntityManagerNestedBean.java

public Dog persistDog(EntityManager parentEm) {
    if (parentEm.hashCode() != em.hashCode()) {
        throw new RuntimeException("This is not good, hashCode is different!");
    }//  w ww . j a va 2  s.c  om

    Dog dog = new Dog();
    dog.setPetName("Joe");
    dog.setBreed("German Shepherd");

    em.persist(dog);
    return dog;
}