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

Hibernate example source code file (AddressId.java)

This example Hibernate source code file (AddressId.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

addressid, addressid, io, serializable, serializable, string, string

The Hibernate AddressId.java source code

//$Id: AddressId.java 5686 2005-02-12 07:27:32Z steveebersole $
package org.hibernate.test.typedonetoone;
import java.io.Serializable;

/**
 * @author Gavin King
 */
public class AddressId implements Serializable {
	private String type;
	private String customerId;
	
	public AddressId(String type, String customerId) {
		this.customerId = customerId;
		this.type = type;
	}
	
	public AddressId() {}
	
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getCustomerId() {
		return customerId;
	}
	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}
	public boolean equals(Object other) {
		if ( !(other instanceof AddressId) ) return false;
		AddressId add = (AddressId) other;
		return type.equals(add.type) && customerId.equals(add.customerId);
	}
	public int hashCode() {
		return customerId.hashCode() + type.hashCode();
	}

}

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate AddressId.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.