|
Hibernate example source code file (Cat.java)
The Hibernate Cat.java source code//$Id$ package org.hibernate.test.annotations.manytomany; import java.util.Set; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; /** * @author Emmanuel Bernard */ @Entity @Table(name = "tbl_cat") //ANN-630 //@org.hibernate.annotations.Table(appliesTo= "TT", indexes = @Index(name = "testidx", columnNames = "cat_id")) public class Cat { private CatPk id; private int age; private Set<Woman> humanContacts; @ManyToMany //@Index(name = "CAT_HUMAN_IDX") @JoinTable(name="TT") public Set<Woman> getHumanContacts() { return humanContacts; } public void setHumanContacts(Set<Woman> humanContacts) { this.humanContacts = humanContacts; } @EmbeddedId() public CatPk getId() { return id; } public void setId(CatPk id) { this.id = id; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public boolean equals(Object o) { if ( this == o ) return true; if ( !( o instanceof Cat ) ) return false; final Cat cat = (Cat) o; if ( !id.equals( cat.id ) ) return false; return true; } public int hashCode() { return id.hashCode(); } } Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate Cat.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.