|
Hibernate example source code file (WomanPk.java)
The Hibernate WomanPk.java source code//$Id$ package org.hibernate.test.annotations.manytomany; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Embeddable; /** * @author Emmanuel Bernard */ @Embeddable public class WomanPk implements Serializable { private String firstName; private String lastName; public int hashCode() { //this implem sucks return getFirstName().hashCode() + getLastName().hashCode(); } public boolean equals(Object obj) { //firstName and lastName are expected to be set in this implem if ( obj != null && obj instanceof WomanPk ) { WomanPk other = (WomanPk) obj; return getFirstName().equals( other.getFirstName() ) && getLastName().equals( other.getLastName() ); } else { return false; } } public void setFirstName(String firstName) { this.firstName = firstName; } public void setLastName(String lastName) { this.lastName = lastName; } @Column(length=128) public String getFirstName() { return firstName; } @Column(length=128) public String getLastName() { return lastName; } } Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate WomanPk.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
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.