Commit f6dae56c by Juho Juopperi

jpa bugfixes

1 parent e5cf2027
......@@ -23,9 +23,9 @@ import javax.persistence.Version;
@Entity
@Table(name = "access_rights")
@NamedQueries( {
@NamedQuery(name = "AccessRight.findAll", query = "SELECT a FROM AccessRight a"),
@NamedQuery(name = "AccessRight.findById", query = "SELECT a FROM AccessRight a WHERE a.id = :id"),
@NamedQuery(name = "AccessRight.findByName", query = "SELECT a FROM AccessRight a WHERE a.name = :name") })
@NamedQuery(name = "AccessRight.findAll", query = "SELECT a FROM AccessRight a"),
@NamedQuery(name = "AccessRight.findById", query = "SELECT a FROM AccessRight a WHERE a.id = :id"),
@NamedQuery(name = "AccessRight.findByName", query = "SELECT a FROM AccessRight a WHERE a.name = :name") })
public class AccessRight implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
......@@ -38,18 +38,18 @@ public class AccessRight implements ModelInterface {
@Column(name = "right_description")
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "id")
@OneToMany(cascade = CascadeType.ALL, mappedBy = "accessRight")
private List<NewsGroup> newsGroups;
@OneToMany(mappedBy = "id")
private List<RoleRight> roleRights;
public Integer getId() {
return id;
return id;
}
public void setId(Integer id) {
this.id = id;
this.id = id;
}
@Version
......@@ -60,79 +60,79 @@ public class AccessRight implements ModelInterface {
}
public AccessRight(Integer accessRightsId) {
this.id = accessRightsId;
this.id = accessRightsId;
}
public AccessRight(Integer accessRightsId, String accessRight) {
this.id = accessRightsId;
this.name = accessRight;
this.id = accessRightsId;
this.name = accessRight;
}
public String getAccessRight() {
return name;
return name;
}
public void setAccessRight(String accessRight) {
this.name = accessRight;
this.name = accessRight;
}
public List<NewsGroup> getNewsGroupList() {
return newsGroups;
return newsGroups;
}
public void setNewsGroupList(List<NewsGroup> newsGroupList) {
this.newsGroups = newsGroupList;
this.newsGroups = newsGroupList;
}
public List<RoleRight> getRoleRightList() {
return roleRights;
return roleRights;
}
public void setRoleRightList(List<RoleRight> roleRightList) {
this.roleRights = roleRightList;
this.roleRights = roleRightList;
}
@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 AccessRight)) {
return false;
}
AccessRight other = (AccessRight) 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 AccessRight)) {
return false;
}
AccessRight other = (AccessRight) 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.AccessRight[id=" + id + "]";
return "fi.insomnia.bortal.model.AccessRight[id=" + id + "]";
}
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
this.jpaVersionField = jpaVersionField;
}
public int getJpaVersionField() {
return jpaVersionField;
return jpaVersionField;
}
public void setDescription(String description) {
this.description = description;
this.description = description;
}
public String getDescription() {
return description;
return description;
}
}
......@@ -29,13 +29,13 @@ import javax.persistence.Version;
@Entity
@Table(name = "entries")
@NamedQueries( {
@NamedQuery(name = "CompoEntry.findAll", query = "SELECT c FROM CompoEntry c"),
@NamedQuery(name = "CompoEntry.findById", query = "SELECT c FROM CompoEntry c WHERE c.id = :id"),
@NamedQuery(name = "CompoEntry.findByCreated", query = "SELECT c FROM CompoEntry c WHERE c.created = :created"),
@NamedQuery(name = "CompoEntry.findByName", query = "SELECT c FROM CompoEntry c WHERE c.name = :name"),
@NamedQuery(name = "CompoEntry.findByNotes", query = "SELECT c FROM CompoEntry c WHERE c.notes = :notes"),
@NamedQuery(name = "CompoEntry.findByScreenMessage", query = "SELECT c FROM CompoEntry c WHERE c.screenMessage = :screenMessage"),
@NamedQuery(name = "CompoEntry.findBySort", query = "SELECT c FROM CompoEntry c WHERE c.sort = :sort") })
@NamedQuery(name = "CompoEntry.findAll", query = "SELECT c FROM CompoEntry c"),
@NamedQuery(name = "CompoEntry.findById", query = "SELECT c FROM CompoEntry c WHERE c.id = :id"),
@NamedQuery(name = "CompoEntry.findByCreated", query = "SELECT c FROM CompoEntry c WHERE c.created = :created"),
@NamedQuery(name = "CompoEntry.findByName", query = "SELECT c FROM CompoEntry c WHERE c.name = :name"),
@NamedQuery(name = "CompoEntry.findByNotes", query = "SELECT c FROM CompoEntry c WHERE c.notes = :notes"),
@NamedQuery(name = "CompoEntry.findByScreenMessage", query = "SELECT c FROM CompoEntry c WHERE c.screenMessage = :screenMessage"),
@NamedQuery(name = "CompoEntry.findBySort", query = "SELECT c FROM CompoEntry c WHERE c.sort = :sort") })
public class CompoEntry implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
......@@ -75,7 +75,7 @@ public class CompoEntry implements ModelInterface {
@JoinColumn(name = "compos_id", referencedColumnName = "compos_id", nullable = false)
@ManyToOne(optional = false)
private Compo composId;
private Compo compo;
@JoinColumn(name = "creator", referencedColumnName = "users_id")
@ManyToOne
......@@ -86,156 +86,156 @@ public class CompoEntry implements ModelInterface {
private int jpaVersionField;
public Integer getId() {
return id;
return id;
}
public void setId(Integer id) {
this.id = id;
this.id = id;
}
public CompoEntry() {
}
public CompoEntry(Integer entriesId) {
this.id = entriesId;
this.id = entriesId;
}
public CompoEntry(Integer entriesId, Date entryCreated, String entryName) {
this.id = entriesId;
this.created = entryCreated;
this.name = entryName;
this.id = entriesId;
this.created = entryCreated;
this.name = entryName;
}
public Date getCreated() {
return created;
return created;
}
public void setCreated(Date entryCreated) {
this.created = entryCreated;
this.created = entryCreated;
}
public String getName() {
return name;
return name;
}
public void setName(String entryName) {
this.name = entryName;
this.name = entryName;
}
public String getNotes() {
return notes;
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
this.notes = notes;
}
public String getScreenMessage() {
return screenMessage;
return screenMessage;
}
public void setScreenMessage(String screenMessage) {
this.screenMessage = screenMessage;
this.screenMessage = screenMessage;
}
public Integer getSort() {
return sort;
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
this.sort = sort;
}
public List<Vote> getVotes() {
return votes;
return votes;
}
public void setVotes(List<Vote> voteList) {
this.votes = voteList;
this.votes = voteList;
}
public List<CompoEntryFile> getFiles() {
return files;
return files;
}
public void setFiles(List<CompoEntryFile> compoEntryFileList) {
this.files = compoEntryFileList;
this.files = compoEntryFileList;
}
public List<CompoEntryParticipant> getParticipants() {
return participants;
return participants;
}
public void setParticipants(
List<CompoEntryParticipant> compoEntryParticipantList) {
this.participants = compoEntryParticipantList;
List<CompoEntryParticipant> compoEntryParticipantList) {
this.participants = compoEntryParticipantList;
}
public Compo getComposId() {
return composId;
public Compo getCompo() {
return compo;
}
public void setComposId(Compo composId) {
this.composId = composId;
public void setCompo(Compo composId) {
this.compo = composId;
}
public User getCreator() {
return creator;
return creator;
}
public void setCreator(User creator) {
this.creator = creator;
this.creator = creator;
}
@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 CompoEntry)) {
return false;
}
CompoEntry other = (CompoEntry) 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 CompoEntry)) {
return false;
}
CompoEntry other = (CompoEntry) 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.CompoEntry[entriesId=" + id + "]";
return "fi.insomnia.bortal.model.CompoEntry[entriesId=" + id + "]";
}
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
this.jpaVersionField = jpaVersionField;
}
public int getJpaVersionField() {
return jpaVersionField;
return jpaVersionField;
}
public void setFinalPosition(Integer finalPosition) {
this.finalPosition = finalPosition;
this.finalPosition = finalPosition;
}
public Integer getFinalPosition() {
return finalPosition;
return finalPosition;
}
public void setCurrentFile(CompoEntryFile currentFile) {
this.currentFile = currentFile;
this.currentFile = currentFile;
}
public CompoEntryFile getCurrentFile() {
return currentFile;
return currentFile;
}
}
......@@ -14,6 +14,8 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;
/**
......@@ -22,8 +24,8 @@ import javax.persistence.Version;
@Entity
@Table(name = "discount_instances")
@NamedQueries( {
@NamedQuery(name = "DiscountInstance.findAll", query = "SELECT d FROM DiscountInstance d"),
@NamedQuery(name = "DiscountInstance.findById", query = "SELECT d FROM DiscountInstance d WHERE d.id = :id") })
@NamedQuery(name = "DiscountInstance.findAll", query = "SELECT d FROM DiscountInstance d"),
@NamedQuery(name = "DiscountInstance.findById", query = "SELECT d FROM DiscountInstance d WHERE d.id = :id") })
public class DiscountInstance implements ModelInterface {
private static final long serialVersionUID = 1L;
......@@ -32,6 +34,7 @@ public class DiscountInstance implements ModelInterface {
private Integer id;
@Column(name = "create_time", nullable = false, columnDefinition = "timestamptz default now()")
@Temporal(TemporalType.TIMESTAMP)
private Date createTime = new Date();
@JoinColumn(name = "account_events_id", referencedColumnName = "account_events_id")
......@@ -54,66 +57,66 @@ public class DiscountInstance implements ModelInterface {
}
public DiscountInstance(Integer discountsInstancesId) {
this.id = discountsInstancesId;
this.id = discountsInstancesId;
}
public AccountEvent getAccountEvent() {
return accountEvent;
return accountEvent;
}
public void setAccountEvent(AccountEvent accountEventsId) {
this.accountEvent = accountEventsId;
this.accountEvent = accountEventsId;
}
public Discount getDiscount() {
return discount;
return discount;
}
public void setDiscount(Discount discountsId) {
this.discount = discountsId;
this.discount = discountsId;
}
public User getUser() {
return user;
return user;
}
public void setUser(User usersId) {
this.user = usersId;
this.user = usersId;
}
@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 DiscountInstance)) {
return false;
}
DiscountInstance other = (DiscountInstance) 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 DiscountInstance)) {
return false;
}
DiscountInstance other = (DiscountInstance) 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.DiscountInstance[discountsInstancesId="
+ getId() + "]";
return "fi.insomnia.bortal.model.DiscountInstance[discountsInstancesId="
+ getId() + "]";
}
/**
* @return the id
*/
public Integer getId() {
return id;
return id;
}
/**
......@@ -121,14 +124,14 @@ public class DiscountInstance 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;
}
/**
......@@ -136,14 +139,14 @@ public class DiscountInstance implements ModelInterface {
* the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
this.jpaVersionField = jpaVersionField;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
this.createTime = createTime;
}
public Date getCreateTime() {
return createTime;
return createTime;
}
}
......@@ -27,14 +27,14 @@ import javax.persistence.Version;
@Entity
@Table(name = "groups")
@NamedQueries( {
@NamedQuery(name = "PlaceGroup.findAll", query = "SELECT p FROM PlaceGroup p"),
@NamedQuery(name = "PlaceGroup.findById", query = "SELECT p FROM PlaceGroup p WHERE p.id = :id"),
@NamedQuery(name = "PlaceGroup.findByCreated", query = "SELECT p FROM PlaceGroup p WHERE p.created = :created"),
@NamedQuery(name = "PlaceGroup.findByEdited", query = "SELECT p FROM PlaceGroup p WHERE p.edited = :edited"),
@NamedQuery(name = "PlaceGroup.findByCode", query = "SELECT p FROM PlaceGroup p WHERE p.code = :code"),
@NamedQuery(name = "PlaceGroup.findByName", query = "SELECT p FROM PlaceGroup p WHERE p.name = :name"),
@NamedQuery(name = "PlaceGroup.findByActive", query = "SELECT p FROM PlaceGroup p WHERE p.active = :active"),
@NamedQuery(name = "PlaceGroup.findByDetails", query = "SELECT p FROM PlaceGroup p WHERE p.details = :details") })
@NamedQuery(name = "PlaceGroup.findAll", query = "SELECT p FROM PlaceGroup p"),
@NamedQuery(name = "PlaceGroup.findById", query = "SELECT p FROM PlaceGroup p WHERE p.id = :id"),
@NamedQuery(name = "PlaceGroup.findByCreated", query = "SELECT p FROM PlaceGroup p WHERE p.created = :created"),
@NamedQuery(name = "PlaceGroup.findByEdited", query = "SELECT p FROM PlaceGroup p WHERE p.edited = :edited"),
@NamedQuery(name = "PlaceGroup.findByCode", query = "SELECT p FROM PlaceGroup p WHERE p.code = :code"),
@NamedQuery(name = "PlaceGroup.findByName", query = "SELECT p FROM PlaceGroup p WHERE p.name = :name"),
@NamedQuery(name = "PlaceGroup.findByActive", query = "SELECT p FROM PlaceGroup p WHERE p.active = :active"),
@NamedQuery(name = "PlaceGroup.findByDetails", query = "SELECT p FROM PlaceGroup p WHERE p.details = :details") })
public class PlaceGroup implements ModelInterface {
private static final long serialVersionUID = 1L;
......@@ -80,121 +80,121 @@ public class PlaceGroup implements ModelInterface {
}
public PlaceGroup(Integer groupsId) {
this.id = groupsId;
this.id = groupsId;
}
public PlaceGroup(Integer groupsId, Date groupCreated, Date groupEdited,
boolean groupActive) {
this.id = groupsId;
this.created = groupCreated;
this.edited = groupEdited;
this.active = groupActive;
boolean groupActive) {
this.id = groupsId;
this.created = groupCreated;
this.edited = groupEdited;
this.active = groupActive;
}
public Date getCreated() {
return created;
return created;
}
public void setCreated(Date groupCreated) {
this.created = groupCreated;
this.created = groupCreated;
}
public Date getEdited() {
return edited;
return edited;
}
public void setEdited(Date groupEdited) {
this.edited = groupEdited;
this.edited = groupEdited;
}
public String getCode() {
return code;
return code;
}
public void setCode(String groupCode) {
this.code = groupCode;
this.code = groupCode;
}
public String getName() {
return name;
return name;
}
public void setName(String groupName) {
this.name = groupName;
this.name = groupName;
}
public boolean getActive() {
return active;
return active;
}
public void setActive(boolean groupActive) {
this.active = groupActive;
this.active = groupActive;
}
public String getDetails() {
return details;
return details;
}
public void setDetails(String groupDetails) {
this.details = groupDetails;
this.details = groupDetails;
}
public User getCreator() {
return creator;
return creator;
}
public void setCreator(User groupCreator) {
this.creator = groupCreator;
this.creator = groupCreator;
}
public List<GroupMembership> getMembers() {
return members;
return members;
}
public void setMembers(List<GroupMembership> groupMembershipList) {
this.members = groupMembershipList;
this.members = groupMembershipList;
}
public List<Place> getPlaces() {
return places;
return places;
}
public void setPlaces(List<Place> placeList) {
this.places = placeList;
this.places = placeList;
}
@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 PlaceGroup)) {
return false;
}
PlaceGroup other = (PlaceGroup) 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 PlaceGroup)) {
return false;
}
PlaceGroup other = (PlaceGroup) 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.PlaceGroup[id=" + getId() + "]";
return "fi.insomnia.bortal.model.PlaceGroup[id=" + getId() + "]";
}
/**
* @return the id
*/
public Integer getId() {
return id;
return id;
}
/**
......@@ -202,14 +202,14 @@ public class PlaceGroup 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;
}
/**
......@@ -217,6 +217,6 @@ public class PlaceGroup implements ModelInterface {
* the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
this.jpaVersionField = jpaVersionField;
}
}
......@@ -104,7 +104,7 @@ public class User implements ModelInterface {
@ManyToMany(cascade = CascadeType.ALL, mappedBy = "users")
private List<Role> roles;
@OneToMany(mappedBy = "id")
@OneToMany(mappedBy = "user")
private List<LogEntry> logEntryList;
@OneToMany(mappedBy = "user")
......@@ -116,7 +116,7 @@ public class User implements ModelInterface {
@OneToMany(mappedBy = "creator")
private List<CompoEntry> compoEntryList;
@OneToMany(mappedBy = "groupCreator")
@OneToMany(mappedBy = "creator")
private List<PlaceGroup> placeGroupList;
@OneToMany(mappedBy = "user")
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!