Commit 424fff02 by Juho Juopperi

model jpa fixes

1 parent f6dae56c
......@@ -41,7 +41,7 @@ public class AccessRight implements ModelInterface {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "accessRight")
private List<NewsGroup> newsGroups;
@OneToMany(mappedBy = "id")
@OneToMany(mappedBy = "accessRight")
private List<RoleRight> roleRights;
public Integer getId() {
......
......@@ -25,9 +25,9 @@ import javax.persistence.Version;
@Entity
@Table(name = "card_templates")
@NamedQueries( {
@NamedQuery(name = "CardTemplate.findAll", query = "SELECT c FROM CardTemplate c"),
@NamedQuery(name = "CardTemplate.findById", query = "SELECT c FROM CardTemplate c WHERE c.id = :id"),
@NamedQuery(name = "CardTemplate.findByName", query = "SELECT c FROM CardTemplate c WHERE c.name = :name") })
@NamedQuery(name = "CardTemplate.findAll", query = "SELECT c FROM CardTemplate c"),
@NamedQuery(name = "CardTemplate.findById", query = "SELECT c FROM CardTemplate c WHERE c.id = :id"),
@NamedQuery(name = "CardTemplate.findByName", query = "SELECT c FROM CardTemplate c WHERE c.name = :name") })
public class CardTemplate implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
......@@ -48,7 +48,7 @@ public class CardTemplate implements ModelInterface {
@OneToMany(mappedBy = "cardTemplate")
private List<Role> roles;
@OneToMany(mappedBy = "cardTemplate")
@OneToMany(mappedBy = "template")
private List<PrintedCard> cards;
@Version
......@@ -59,95 +59,95 @@ public class CardTemplate implements ModelInterface {
}
public CardTemplate(Integer cardTemplatesId) {
this.id = cardTemplatesId;
this.id = cardTemplatesId;
}
public CardTemplate(Integer cardTemplatesId, String templateName) {
this.id = cardTemplatesId;
this.name = templateName;
this.id = cardTemplatesId;
this.name = templateName;
}
public byte[] getImage() {
return image;
return image;
}
public void setImage(byte[] templateImage) {
this.image = templateImage;
this.image = templateImage;
}
public String getName() {
return name;
return name;
}
public void setName(String templateName) {
this.name = templateName;
this.name = templateName;
}
public Event getEvent() {
return event;
return event;
}
public Integer getId() {
return id;
return id;
}
public void setId(Integer id) {
this.id = id;
this.id = id;
}
public void setEvent(Event eventsId) {
this.event = eventsId;
this.event = eventsId;
}
public List<Role> getRoles() {
return roles;
return roles;
}
public void setRoles(List<Role> roleList) {
this.roles = roleList;
this.roles = roleList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are
// not set
if (!(object instanceof CardTemplate)) {
return false;
}
CardTemplate other = (CardTemplate) object;
if ((this.id == null && other.id != null)
|| (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
// TODO: Warning - this method won't work in the case the id fields are
// not set
if (!(object instanceof CardTemplate)) {
return false;
}
CardTemplate other = (CardTemplate) object;
if ((this.id == null && other.id != null)
|| (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "fi.insomnia.bortal.model.CardTemplate[id=" + id + "]";
return "fi.insomnia.bortal.model.CardTemplate[id=" + id + "]";
}
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
this.jpaVersionField = jpaVersionField;
}
public int getJpaVersionField() {
return jpaVersionField;
return jpaVersionField;
}
public void setCards(List<PrintedCard> cards) {
this.cards = cards;
this.cards = cards;
}
public List<PrintedCard> getCards() {
return cards;
return cards;
}
}
......@@ -21,9 +21,9 @@ import javax.persistence.Version;
@Entity
@Table(name = "locations")
@NamedQueries( {
@NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"),
@NamedQuery(name = "Location.findById", query = "SELECT l FROM Location l WHERE l.id = :id"),
@NamedQuery(name = "Location.findByLocationName", query = "SELECT l FROM Location l WHERE l.locationName = :name") })
@NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"),
@NamedQuery(name = "Location.findById", query = "SELECT l FROM Location l WHERE l.id = :id"),
@NamedQuery(name = "Location.findByLocationName", query = "SELECT l FROM Location l WHERE l.locationName = :name") })
public class Location implements ModelInterface {
private static final long serialVersionUID = 1L;
......@@ -34,7 +34,7 @@ public class Location implements ModelInterface {
@Column(name = "location_name", nullable = false)
private String name;
@OneToMany(mappedBy = "id")
@OneToMany(mappedBy = "location")
private List<Reader> readers;
@OneToMany(mappedBy = "currentLocation")
......@@ -48,70 +48,70 @@ public class Location implements ModelInterface {
}
public Location(Integer locationsId) {
this.id = locationsId;
this.id = locationsId;
}
public Location(Integer locationsId, String locationName) {
this.id = locationsId;
this.name = locationName;
this.id = locationsId;
this.name = locationName;
}
public String getName() {
return name;
return name;
}
public void setName(String locationName) {
this.name = locationName;
this.name = locationName;
}
public List<Reader> getReaders() {
return readers;
return readers;
}
public void setReaders(List<Reader> readerList) {
this.readers = readerList;
this.readers = readerList;
}
public List<PrintedCard> getPrintedCardsAtLocation() {
return printedCardsAtLocation;
return printedCardsAtLocation;
}
public void setPrintedCardsAtLocation(List<PrintedCard> printedCardList) {
this.printedCardsAtLocation = printedCardList;
this.printedCardsAtLocation = printedCardList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (getId() != null ? getId().hashCode() : 0);
return hash;
int hash = 0;
hash += (getId() != null ? getId().hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are
// not set
if (!(object instanceof Location)) {
return false;
}
Location other = (Location) object;
if ((this.getId() == null && other.getId() != null)
|| (this.getId() != null && !this.id.equals(other.id))) {
return false;
}
return true;
// TODO: Warning - this method won't work in the case the id fields are
// not set
if (!(object instanceof Location)) {
return false;
}
Location other = (Location) object;
if ((this.getId() == null && other.getId() != null)
|| (this.getId() != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "fi.insomnia.bortal.model.Location[id=" + getId() + "]";
return "fi.insomnia.bortal.model.Location[id=" + getId() + "]";
}
/**
* @return the id
*/
public Integer getId() {
return id;
return id;
}
/**
......@@ -119,14 +119,14 @@ public class Location implements ModelInterface {
* the id to set
*/
public void setId(Integer id) {
this.id = id;
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
return jpaVersionField;
}
/**
......@@ -134,6 +134,6 @@ public class Location implements ModelInterface {
* the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
this.jpaVersionField = jpaVersionField;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!