1 /*
2 * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3 * the spring framework, http://el4j.sf.net
4 * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5 * 1000 Lausanne, Switzerland, http://www.elca.ch
6 *
7 * EL4J is published under the GNU Lesser General Public License (LGPL)
8 * Version 2.1. See http://www.gnu.org/licenses/
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * For alternative licensing, please contact info@elca.ch
16 */
17 package ch.elca.el4j.tests.tcpforwarder.dom;
18
19 import javax.persistence.AttributeOverride;
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.SequenceGenerator;
23 import javax.persistence.Table;
24
25 import org.hibernate.validator.NotNull;
26
27 import ch.elca.el4j.services.persistence.generic.dto.AbstractIntKeyIntOptimisticLockingDto;
28 import ch.elca.el4j.util.codingsupport.ObjectUtils;
29 import ch.elca.el4j.util.dom.annotations.MemberOrder;
30
31 /**
32 * Simple domain object.
33 *
34 * @svnLink $Revision: 3881 $;$Date: 2009-08-04 15:22:05 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/tests/tcp_forwarder/src/test/java/ch/elca/el4j/tests/tcpforwarder/dom/Name.java $
35 *
36 * @author David Stefan (DST)
37 */
38 @MemberOrder({
39 "name"
40 })
41 @Entity
42 @Table(name = "NAMES")
43 @AttributeOverride(name = "key", column = @Column(name = "NAMEID"))
44 @SequenceGenerator(name = "keyid_generator", sequenceName = "name_sequence")
45 public class Name extends AbstractIntKeyIntOptimisticLockingDto {
46
47 /**
48 * The Name and only field.
49 */
50 private String m_name;
51
52 /**
53 * @return Returns the name.
54 */
55 @NotNull
56 public String getName() {
57 return m_name;
58 }
59
60 /**
61 * @param name
62 * The name to set.
63 */
64 public void setName(String name) {
65 m_name = name;
66 }
67
68 /**
69 * {@inheritDoc}
70 */
71 public int hashCode() {
72 return super.hashCode();
73 }
74
75 /**
76 * {@inheritDoc}
77 */
78 public boolean equals(Object object) {
79 if (super.equals(object)
80 && object instanceof Name) {
81 Name other = (Name) object;
82 return ObjectUtils.nullSaveEquals(m_name, other.m_name);
83 } else {
84 return false;
85 }
86 }
87 }