alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (CustomerInventoryPK.java)

This example Hibernate source code file (CustomerInventoryPK.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

customer, customer, customerinventorypk, customerinventorypk, integer, integer, io, serializable, serializable

The Hibernate CustomerInventoryPK.java source code

package org.hibernate.test.annotations.derivedidentities.e1.b2;
import java.io.Serializable;


public class CustomerInventoryPK implements Serializable {

	private Integer id;

	private Customer customer;

	public CustomerInventoryPK() {
	}

	public CustomerInventoryPK(Integer id, Customer customer) {
		this.id = id;
		this.customer = customer;
	}

	public boolean equals(Object other) {
		if ( other == this ) {
			return true;
		}
		if ( other == null || getClass() != other.getClass() ) {
			return false;
		}
		CustomerInventoryPK cip = ( CustomerInventoryPK ) other;
		return ( getCustomer().getId() == cip.getCustomer().getId() && ( id == cip.id ||
				( id != null && id.equals( cip.id ) ) ) );
	}

	public int hashCode() {
		return ( id == null ? 0 : id.hashCode() ) ^ getCustomer().getId();
	}

	public Integer getId() {
		return id;
	}

	public Customer getCustomer() {
		return customer;
	}


}

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate CustomerInventoryPK.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.