mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 00:24:57 +00:00
HHH-11526 - Documentation for custom collection types
This commit is contained in:
parent
c87253575d
commit
6ed1303349
@ -77,7 +77,7 @@ public static class Person {
|
||||
@CollectionType( type = "org.hibernate.userguide.collections.type.QueueType")
|
||||
private Collection<Phone> phones = new LinkedList<>();
|
||||
|
||||
//Getters and setters are omitted for brevity
|
||||
//Constructors are omitted for brevity
|
||||
|
||||
//end::collections-custom-collection-mapping-example[]
|
||||
|
||||
@ -88,10 +88,10 @@ public Person(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
//tag::collections-custom-collection-mapping-example[]
|
||||
public Queue<Phone> getPhones() {
|
||||
return (Queue<Phone>) phones;
|
||||
}
|
||||
//tag::collections-custom-collection-mapping-example[]
|
||||
}
|
||||
|
||||
@Entity(name = "Phone")
|
||||
@ -131,6 +131,7 @@ public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
//tag::collections-custom-collection-mapping-example[]
|
||||
@Override
|
||||
public int compareTo(Phone o) {
|
||||
return number.compareTo( o.getNumber() );
|
||||
@ -152,7 +153,6 @@ public boolean equals(Object o) {
|
||||
public int hashCode() {
|
||||
return Objects.hash( number );
|
||||
}
|
||||
//tag::collections-custom-collection-mapping-example[]
|
||||
}
|
||||
//end::collections-custom-collection-mapping-example[]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user