22
33import java .io .Serializable ;
44import java .util .Set ;
5- import com .google .common .collect .Sets ;
6- import javax .persistence .*;
5+
6+ import javax .persistence .CascadeType ;
7+ import javax .persistence .Entity ;
8+ import javax .persistence .FetchType ;
9+ import javax .persistence .GeneratedValue ;
10+ import javax .persistence .GenerationType ;
11+ import javax .persistence .Id ;
12+ import javax .persistence .NamedQuery ;
13+ import javax .persistence .OneToMany ;
14+
715import org .hibernate .annotations .OrderBy ;
816
17+ import com .google .common .collect .Sets ;
18+
919@ Entity
1020@ NamedQuery (name = "Bar.findAll" , query = "SELECT b FROM Bar b" )
1121public class Bar implements Serializable {
@@ -16,7 +26,7 @@ public Bar() {
1626
1727 public Bar (final String name ) {
1828 super ();
19-
29+
2030 this .name = name ;
2131 }
2232
@@ -31,41 +41,42 @@ public Bar(final String name) {
3141 @ OrderBy (clause = "NAME DESC" )
3242 Set <Foo > fooSet = Sets .newHashSet ();
3343
34- //API
35-
44+ // API
45+
3646 public Set <Foo > getFooSet () {
3747 return fooSet ;
3848 }
39-
49+
4050 public void setFooSet (final Set <Foo > fooSet ) {
4151 this .fooSet = fooSet ;
4252 }
4353
4454 public int getId () {
45- return this . id ;
55+ return id ;
4656 }
4757
4858 public void setId (final int id ) {
4959 this .id = id ;
5060 }
5161
5262 public String getName () {
53- return this . name ;
63+ return name ;
5464 }
5565
5666 public void setName (final String name ) {
5767 this .name = name ;
5868 }
69+
5970 //
60-
71+
6172 @ Override
6273 public int hashCode () {
6374 final int prime = 31 ;
6475 int result = 1 ;
6576 result = prime * result + ((name == null ) ? 0 : name .hashCode ());
6677 return result ;
6778 }
68-
79+
6980 @ Override
7081 public boolean equals (final Object obj ) {
7182 if (this == obj )
@@ -82,13 +93,12 @@ public boolean equals(final Object obj) {
8293 return false ;
8394 return true ;
8495 }
85-
96+
8697 @ Override
8798 public String toString () {
8899 final StringBuilder builder = new StringBuilder ();
89100 builder .append ("Bar [name=" ).append (name ).append ("]" );
90101 return builder .toString ();
91102 }
92103
93-
94104}
0 commit comments