1 package ru
.rentdom
.entities
.coords
;
5 import javax
.persistence
.CascadeType
;
6 import javax
.persistence
.Entity
;
7 import javax
.persistence
.FetchType
;
8 import javax
.persistence
.ManyToOne
;
9 import javax
.persistence
.OneToMany
;
10 import javax
.persistence
.Table
;
12 import ru
.rentdom
.entities
.housing
.Housing
;
14 @Entity(name
= "street")
15 @Table(name
= "streets")
16 public class Street
extends Coord
{
17 private static final long serialVersionUID
= -4821414637331301222L;
20 private Set
<Housing
> housings
;
22 public Street(){super();}
24 public Street(String name
, Town town
) {
28 @ManyToOne(optional
=false, fetch
=FetchType
.LAZY
)
29 public Town
getTown() {
32 public void setTown(Town town
) {
36 @OneToMany(mappedBy
="street", fetch
=FetchType
.LAZY
, cascade
=CascadeType
.ALL
)
37 public Set
<Housing
> getHousings() {
40 public void setHousings(Set
<Housing
> housings
) {
41 this.housings
= housings
;