Commit 11e3b92e by Juho Juopperi

model cleanup

1 parent 166211b2
......@@ -26,7 +26,7 @@ import javax.persistence.Version;
@Table(name = "discounts")
@NamedQueries( {
@NamedQuery(name = "Discount.findAll", query = "SELECT d FROM Discount d"),
@NamedQuery(name = "Discount.findByDiscountsId", query = "SELECT d FROM Discount d WHERE d.id = :id"),
@NamedQuery(name = "Discount.findById", query = "SELECT d FROM Discount d WHERE d.id = :id"),
@NamedQuery(name = "Discount.findByPercentage", query = "SELECT d FROM Discount d WHERE d.percentage = :percentage"),
@NamedQuery(name = "Discount.findByCode", query = "SELECT d FROM Discount d WHERE d.code = :code"),
@NamedQuery(name = "Discount.findByDetails", query = "SELECT d FROM Discount d WHERE d.details = :details"),
......
......@@ -27,8 +27,8 @@ import javax.persistence.Version;
@Table(name = "products")
@NamedQueries( {
@NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p"),
@NamedQuery(name = "Product.findByProductsId", query = "SELECT p FROM Product p WHERE p.productsId = :productsId"),
@NamedQuery(name = "Product.findByProductName", query = "SELECT p FROM Product p WHERE p.productName = :productName"),
@NamedQuery(name = "Product.findById", query = "SELECT p FROM Product p WHERE p.id = :id"),
@NamedQuery(name = "Product.findByProductName", query = "SELECT p FROM Product p WHERE p.name = :name"),
@NamedQuery(name = "Product.findByPrice", query = "SELECT p FROM Product p WHERE p.price = :price"),
@NamedQuery(name = "Product.findBySort", query = "SELECT p FROM Product p WHERE p.sort = :sort"),
@NamedQuery(name = "Product.findByBarcode", query = "SELECT p FROM Product p WHERE p.barcode = :barcode") })
......@@ -41,7 +41,7 @@ public class Product implements ModelInterface {
private Integer id;
@Column(name = "product_name")
private String productName;
private String name;
@Column(name = "price", nullable = false)
private BigInteger price;
......@@ -82,12 +82,12 @@ public class Product implements ModelInterface {
this.sort = sort;
}
public String getProductName() {
return productName;
public String getName() {
return name;
}
public void setProductName(String productName) {
this.productName = productName;
public void setName(String productName) {
this.name = productName;
}
public BigInteger getPrice() {
......
......@@ -20,30 +20,35 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "readers")
@NamedQueries( {
@NamedQuery(name = "Reader.findAll", query = "SELECT r FROM Reader r"),
@NamedQuery(name = "Reader.findByReadersId", query = "SELECT r FROM Reader r WHERE r.readersId = :readersId"),
@NamedQuery(name = "Reader.findByReaderId", query = "SELECT r FROM Reader r WHERE r.readerId = :readerId"),
@NamedQuery(name = "Reader.findByReaderDescription", query = "SELECT r FROM Reader r WHERE r.readerDescription = :readerDescription") })
@NamedQuery(name = "Reader.findById", query = "SELECT r FROM Reader r WHERE r.id = :id"),
@NamedQuery(name = "Reader.findByIdentification", query = "SELECT r FROM Reader r WHERE r.identification = :identification"),
@NamedQuery(name = "Reader.findByDescription", query = "SELECT r FROM Reader r WHERE r.description = :description") })
public class Reader implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "readers_id", nullable = false)
private Integer id;
@Column(name = "reader_id")
private String readerId;
@Column(name = "reader_ident")
private String identification;
@Column(name = "reader_description")
private String readerDescription;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "readersId")
private List<ReaderEvent> readerEventList;
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "reader")
private List<ReaderEvent> events;
@JoinColumn(name = "locations_id", referencedColumnName = "locations_id")
@ManyToOne
private Location locationsId;
private Location location;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -55,36 +60,36 @@ public class Reader implements ModelInterface {
this.id = readersId;
}
public String getReaderId() {
return readerId;
public String getIdentification() {
return identification;
}
public void setReaderId(String readerId) {
this.readerId = readerId;
public void setIdentification(String readerId) {
this.identification = readerId;
}
public String getReaderDescription() {
return readerDescription;
public String getDescription() {
return description;
}
public void setReaderDescription(String readerDescription) {
this.readerDescription = readerDescription;
public void setDescription(String readerDescription) {
this.description = readerDescription;
}
public List<ReaderEvent> getReaderEventList() {
return readerEventList;
public List<ReaderEvent> getEvents() {
return events;
}
public void setReaderEventList(List<ReaderEvent> readerEventList) {
this.readerEventList = readerEventList;
public void setEvents(List<ReaderEvent> readerEventList) {
this.events = readerEventList;
}
public Location getLocationsId() {
return locationsId;
public Location getLocation() {
return location;
}
public void setLocationsId(Location locationsId) {
this.locationsId = locationsId;
public void setLocation(Location locationsId) {
this.location = locationsId;
}
@Override
......@@ -111,7 +116,7 @@ public class Reader implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.Reader[readersId=" + getId() + "]";
return "fi.insomnia.bortal.model.Reader[id=" + getId() + "]";
}
/**
......
......@@ -20,33 +20,37 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "reader_events")
@NamedQueries( {
@NamedQuery(name = "ReaderEvent.findAll", query = "SELECT r FROM ReaderEvent r"),
@NamedQuery(name = "ReaderEvent.findByReaderEventsId", query = "SELECT r FROM ReaderEvent r WHERE r.readerEventsId = :readerEventsId"),
@NamedQuery(name = "ReaderEvent.findByEventTime", query = "SELECT r FROM ReaderEvent r WHERE r.eventTime = :eventTime"),
@NamedQuery(name = "ReaderEvent.findById", query = "SELECT r FROM ReaderEvent r WHERE r.id = :id"),
@NamedQuery(name = "ReaderEvent.findByTime", query = "SELECT r FROM ReaderEvent r WHERE r.time = :time"),
@NamedQuery(name = "ReaderEvent.findByValue", query = "SELECT r FROM ReaderEvent r WHERE r.value = :value") })
public class ReaderEvent implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "reader_events_id", nullable = false)
private Integer id;
@Column(name = "event_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date eventTime;
private Date time;
@Column(name = "value")
private String value;
@JoinColumn(name = "printed_cards_id", referencedColumnName = "printed_cards_id", nullable = false)
@ManyToOne(optional = false)
private PrintedCard printedCardsId;
private PrintedCard printedCard;
@JoinColumn(name = "readers_id", referencedColumnName = "readers_id", nullable = false)
@ManyToOne(optional = false)
private Reader readersId;
private Reader reader;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -60,15 +64,15 @@ public class ReaderEvent implements ModelInterface {
public ReaderEvent(Integer readerEventsId, Date eventTime) {
this.id = readerEventsId;
this.eventTime = eventTime;
this.time = eventTime;
}
public Date getEventTime() {
return eventTime;
public Date getTime() {
return time;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
public void setTime(Date eventTime) {
this.time = eventTime;
}
public String getValue() {
......@@ -79,20 +83,20 @@ public class ReaderEvent implements ModelInterface {
this.value = value;
}
public PrintedCard getPrintedCardsId() {
return printedCardsId;
public PrintedCard getPrintedCard() {
return printedCard;
}
public void setPrintedCardsId(PrintedCard printedCardsId) {
this.printedCardsId = printedCardsId;
public void setPrintedCard(PrintedCard printedCardsId) {
this.printedCard = printedCardsId;
}
public Reader getReadersId() {
return readersId;
public Reader getReader() {
return reader;
}
public void setReadersId(Reader readersId) {
this.readersId = readersId;
public void setReader(Reader readersId) {
this.reader = readersId;
}
@Override
......@@ -119,8 +123,7 @@ public class ReaderEvent implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.ReaderEvent[readerEventsId=" + getId()
+ "]";
return "fi.insomnia.bortal.model.ReaderEvent[id=" + getId() + "]";
}
/**
......
......@@ -11,6 +11,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
......@@ -26,8 +27,8 @@ import javax.persistence.Version;
@Table(name = "roles")
@NamedQueries( {
@NamedQuery(name = "Role.findAll", query = "SELECT r FROM Role r"),
@NamedQuery(name = "Role.findByRolesId", query = "SELECT r FROM Role r WHERE r.rolesId = :rolesId"),
@NamedQuery(name = "Role.findByRoleName", query = "SELECT r FROM Role r WHERE r.roleName = :roleName") })
@NamedQuery(name = "Role.findById", query = "SELECT r FROM Role r WHERE r.id = :id"),
@NamedQuery(name = "Role.findByRoleName", query = "SELECT r FROM Role r WHERE r.name = :name") })
public class Role implements ModelInterface {
private static final long serialVersionUID = 1L;
......@@ -37,19 +38,21 @@ public class Role implements ModelInterface {
private Integer id;
@Column(name = "role_name", nullable = false)
private String roleName;
private String name;
@JoinTable(name = "role_memberships")
@ManyToMany(cascade = CascadeType.ALL)
private List<User> users;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "rolesId")
private List<RoleInheritance> roleInheritanceList;
@ManyToMany
@JoinTable(name = "role_inheritance")
private List<Role> children;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "inherits")
private List<RoleInheritance> roleInheritanceList1;
@ManyToMany(mappedBy = "children")
private List<Role> parents;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "rolesId")
private List<RoleRight> roleRightList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "role")
private List<RoleRight> roleRights;
@JoinColumn(name = "card_templates_id", referencedColumnName = "card_templates_id")
@ManyToOne
......@@ -57,7 +60,7 @@ public class Role implements ModelInterface {
@JoinColumn(name = "events_id", referencedColumnName = "events_id", nullable = false)
@ManyToOne(optional = false)
private Event eventsId;
private Event event;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "role")
private List<Discount> discounts;
......@@ -75,40 +78,23 @@ public class Role implements ModelInterface {
public Role(Integer rolesId, String roleName) {
this.id = rolesId;
this.roleName = roleName;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public List<RoleInheritance> getRoleInheritanceList() {
return roleInheritanceList;
}
public void setRoleInheritanceList(List<RoleInheritance> roleInheritanceList) {
this.roleInheritanceList = roleInheritanceList;
this.name = roleName;
}
public List<RoleInheritance> getRoleInheritanceList1() {
return roleInheritanceList1;
public String getName() {
return name;
}
public void setRoleInheritanceList1(
List<RoleInheritance> roleInheritanceList1) {
this.roleInheritanceList1 = roleInheritanceList1;
public void setName(String roleName) {
this.name = roleName;
}
public List<RoleRight> getRoleRightList() {
return roleRightList;
public List<RoleRight> getRoleRights() {
return roleRights;
}
public void setRoleRightList(List<RoleRight> roleRightList) {
this.roleRightList = roleRightList;
public void setRoleRights(List<RoleRight> roleRightList) {
this.roleRights = roleRightList;
}
public CardTemplate getCardTemplate() {
......@@ -119,12 +105,12 @@ public class Role implements ModelInterface {
this.cardTemplate = cardTemplatesId;
}
public Event getEventsId() {
return eventsId;
public Event getEvent() {
return event;
}
public void setEventsId(Event eventsId) {
this.eventsId = eventsId;
public void setEvent(Event eventsId) {
this.event = eventsId;
}
@Override
......@@ -151,7 +137,7 @@ public class Role implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.Role[rolesId=" + getId() + "]";
return "fi.insomnia.bortal.model.Role[id=" + getId() + "]";
}
/**
......@@ -199,4 +185,20 @@ public class Role implements ModelInterface {
public List<Discount> getDiscounts() {
return discounts;
}
public void setParents(List<Role> parents) {
this.parents = parents;
}
public List<Role> getParents() {
return parents;
}
public void setChildren(List<Role> children) {
this.children = children;
}
public List<Role> getChildren() {
return children;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "role_inheritance", uniqueConstraints = { @UniqueConstraint(columnNames = {
"roles_id", "inherits" }) })
@NamedQueries( {
@NamedQuery(name = "RoleInheritance.findAll", query = "SELECT r FROM RoleInheritance r"),
@NamedQuery(name = "RoleInheritance.findByRoleInheritanceId", query = "SELECT r FROM RoleInheritance r WHERE r.roleInheritanceId = :roleInheritanceId") })
public class RoleInheritance implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "role_inheritance_id", nullable = false)
private Integer id;
@JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false)
@ManyToOne(optional = false)
private Role rolesId;
@JoinColumn(name = "inherits", referencedColumnName = "roles_id", nullable = false)
@ManyToOne(optional = false)
private Role inherits;
@Version
@Column(nullable = false)
private int jpaVersionField;
public RoleInheritance() {
}
public RoleInheritance(Integer roleInheritanceId) {
this.id = roleInheritanceId;
}
public Role getRolesId() {
return rolesId;
}
public void setRolesId(Role rolesId) {
this.rolesId = rolesId;
}
public Role getInherits() {
return inherits;
}
public void setInherits(Role inherits) {
this.inherits = inherits;
}
@Override
public int hashCode() {
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 RoleInheritance)) {
return false;
}
RoleInheritance other = (RoleInheritance) 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.RoleInheritance[roleInheritanceId="
+ getId() + "]";
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id
* the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField
* the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
}
......@@ -22,9 +22,10 @@ import javax.persistence.Version;
@Table(name = "role_rights")
@NamedQueries( {
@NamedQuery(name = "RoleRight.findAll", query = "SELECT r FROM RoleRight r"),
@NamedQuery(name = "RoleRight.findByRoleRights", query = "SELECT r FROM RoleRight r WHERE r.roleRights = :roleRights"),
@NamedQuery(name = "RoleRight.findById", query = "SELECT r FROM RoleRight r WHERE r.id = :id"),
@NamedQuery(name = "RoleRight.findByRead", query = "SELECT r FROM RoleRight r WHERE r.read = :read"),
@NamedQuery(name = "RoleRight.findByWrite", query = "SELECT r FROM RoleRight r WHERE r.write = :write") })
@NamedQuery(name = "RoleRight.findByWrite", query = "SELECT r FROM RoleRight r WHERE r.write = :write"),
@NamedQuery(name = "RoleRight.findByExecute", query = "SELECT r FROM RoleRight r WHERE r.execute = :execute") })
public class RoleRight implements ModelInterface {
private static final long serialVersionUID = 1L;
......@@ -37,13 +38,18 @@ public class RoleRight implements ModelInterface {
@Column(name = "write", nullable = false)
private boolean write;
// TODO: add execute
@Column(name = "write", nullable = false)
private boolean execute;
@JoinColumn(name = "access_rights_id", referencedColumnName = "access_rights_id")
@ManyToOne
private AccessRight accessRightsId;
private AccessRight accessRight;
@JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false)
@ManyToOne(optional = false)
private Role rolesId;
private Role role;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -77,20 +83,20 @@ public class RoleRight implements ModelInterface {
this.write = write;
}
public AccessRight getAccessRightsId() {
return accessRightsId;
public AccessRight getAccessRight() {
return accessRight;
}
public void setAccessRightsId(AccessRight accessRightsId) {
this.accessRightsId = accessRightsId;
public void setAccessRight(AccessRight accessRightsId) {
this.accessRight = accessRightsId;
}
public Role getRolesId() {
return rolesId;
public Role getRole() {
return role;
}
public void setRolesId(Role rolesId) {
this.rolesId = rolesId;
public void setRole(Role rolesId) {
this.role = rolesId;
}
@Override
......@@ -149,4 +155,12 @@ public class RoleRight implements ModelInterface {
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
public void setExecute(boolean execute) {
this.execute = execute;
}
public boolean isExecute() {
return execute;
}
}
......@@ -27,7 +27,7 @@ import javax.persistence.Version;
@Table(name = "users")
@NamedQueries( {
@NamedQuery(name = "User.findAll", query = "SELECT u FROM User u"),
@NamedQuery(name = "User.findByUsersId", query = "SELECT u FROM User u WHERE u.usersId = :usersId"),
@NamedQuery(name = "User.findById", query = "SELECT u FROM User u WHERE u.id = :id"),
@NamedQuery(name = "User.findByCreated", query = "SELECT u FROM User u WHERE u.created = :created"),
@NamedQuery(name = "User.findByActive", query = "SELECT u FROM User u WHERE u.active = :active"),
@NamedQuery(name = "User.findByPassword", query = "SELECT u FROM User u WHERE u.password = :password"),
......@@ -46,51 +46,73 @@ import javax.persistence.Version;
public class User implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "users_id", nullable = false)
private Integer id;
@Column(name = "created", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date created;
@Column(name = "active", nullable = false)
private boolean active;
@Column(name = "password")
private String password;
@Column(name = "lastname", nullable = false)
private String lastname;
@Column(name = "firstnames", nullable = false)
private String firstnames;
@Column(name = "birthday")
@Temporal(TemporalType.TIMESTAMP)
private Date birthday;
@Column(name = "nick")
private String nick;
@Column(name = "email")
private String email;
@Column(name = "address")
private String address;
@Column(name = "zip")
private String zip;
@Column(name = "postal_code")
private String postalCode;
@Column(name = "town")
private String town;
@Column(name = "phone")
private String phone;
@Column(name = "female")
private Boolean female;
@Column(name = "login")
private String login;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "voter")
private List<Vote> votes;
@ManyToMany(cascade = CascadeType.ALL, mappedBy = "users")
private List<Role> roles;
@OneToMany(mappedBy = "usersId")
@OneToMany(mappedBy = "id")
private List<LogEntry> logEntryList;
@OneToMany(mappedBy = "user")
private List<UserImage> userImageList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "users")
private List<CompoEntryParticipant> compoEntryParticipantList;
@OneToMany(mappedBy = "creator")
private List<CompoEntry> compoEntryList;
......@@ -107,19 +129,20 @@ public class User implements ModelInterface {
private List<Place> currentPlaces;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
private List<PrintedCard> printedCardList;
private List<PrintedCard> printedCards;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
private List<AccountEvent> accountEventList;
private List<AccountEvent> accountEvents;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
private List<DiscountInstance> discountInstanceList;
private List<DiscountInstance> discountInstances;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
private List<Bill> billList;
private List<Bill> bills;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "seller")
private List<AccountEvent> soldItems;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -333,37 +356,36 @@ public class User implements ModelInterface {
this.currentPlaces = placeList;
}
public List<PrintedCard> getPrintedCardList() {
return printedCardList;
public List<PrintedCard> getPrintedCards() {
return printedCards;
}
public void setPrintedCardList(List<PrintedCard> printedCardList) {
this.printedCardList = printedCardList;
public void setPrintedCards(List<PrintedCard> printedCardList) {
this.printedCards = printedCardList;
}
public List<AccountEvent> getAccountEventList() {
return accountEventList;
public List<AccountEvent> getAccountEvents() {
return accountEvents;
}
public void setAccountEventList(List<AccountEvent> accountEventList) {
this.accountEventList = accountEventList;
public void setAccountEvents(List<AccountEvent> accountEventList) {
this.accountEvents = accountEventList;
}
public List<DiscountInstance> getDiscountInstanceList() {
return discountInstanceList;
public List<DiscountInstance> getDiscountInstances() {
return discountInstances;
}
public void setDiscountInstanceList(
List<DiscountInstance> discountInstanceList) {
this.discountInstanceList = discountInstanceList;
public void setDiscountInstances(List<DiscountInstance> discountInstanceList) {
this.discountInstances = discountInstanceList;
}
public List<Bill> getBillList() {
return billList;
public List<Bill> getBills() {
return bills;
}
public void setBillList(List<Bill> billList) {
this.billList = billList;
public void setBills(List<Bill> billList) {
this.bills = billList;
}
@Override
......@@ -390,7 +412,7 @@ public class User implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.User[usersId=" + getId() + "]";
return "fi.insomnia.bortal.model.User[id=" + getId() + "]";
}
/**
......
......@@ -17,34 +17,40 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "user_images")
@NamedQueries( {
@NamedQuery(name = "UserImage.findAll", query = "SELECT u FROM UserImage u"),
@NamedQuery(name = "UserImage.findByUserImagesId", query = "SELECT u FROM UserImage u WHERE u.userImagesId = :userImagesId"),
@NamedQuery(name = "UserImage.findById", query = "SELECT u FROM UserImage u WHERE u.id = :id"),
@NamedQuery(name = "UserImage.findByName", query = "SELECT u FROM UserImage u WHERE u.name = :name"),
@NamedQuery(name = "UserImage.findByDescription", query = "SELECT u FROM UserImage u WHERE u.description = :description"),
@NamedQuery(name = "UserImage.findByMimeType", query = "SELECT u FROM UserImage u WHERE u.mimeType = :mimeType") })
public class UserImage implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "user_images_id", nullable = false)
private Integer id;
@Column(name = "name")
private String name;
@Column(name = "description")
private String description;
@Column(name = "mime_type")
private String mimeType;
@Lob
@Column(name = "image_data")
private byte[] imageData;
@JoinColumn(name = "users_id", referencedColumnName = "users_id")
@ManyToOne
private User user;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -112,8 +118,7 @@ public class UserImage implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.UserImage[userImagesId=" + getId()
+ "]";
return "fi.insomnia.bortal.model.UserImage[id=" + getId() + "]";
}
/**
......
......@@ -27,9 +27,9 @@ import javax.persistence.Version;
"entries_id", "users_id" }) })
@NamedQueries( {
@NamedQuery(name = "Vote.findAll", query = "SELECT v FROM Vote v"),
@NamedQuery(name = "Vote.findByVotesId", query = "SELECT v FROM Vote v WHERE v.votesId = :votesId"),
@NamedQuery(name = "Vote.findById", query = "SELECT v FROM Vote v WHERE v.id = :id"),
@NamedQuery(name = "Vote.findByScore", query = "SELECT v FROM Vote v WHERE v.score = :score"),
@NamedQuery(name = "Vote.findByVoteTime", query = "SELECT v FROM Vote v WHERE v.voteTime = :voteTime") })
@NamedQuery(name = "Vote.findByTime", query = "SELECT v FROM Vote v WHERE v.time = :time") })
public class Vote implements ModelInterface {
private static final long serialVersionUID = 1L;
......@@ -40,7 +40,7 @@ public class Vote implements ModelInterface {
private Integer score;
@Column(name = "vote_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date voteTime;
private Date time;
@JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false)
@ManyToOne(optional = false)
private CompoEntry compoEntry;
......@@ -60,7 +60,7 @@ public class Vote implements ModelInterface {
public Vote(Integer votesId, Date voteTime) {
this.id = votesId;
this.voteTime = voteTime;
this.time = voteTime;
}
public Integer getId() {
......@@ -79,12 +79,12 @@ public class Vote implements ModelInterface {
this.score = score;
}
public Date getVoteTime() {
return voteTime;
public Date getTime() {
return time;
}
public void setVoteTime(Date voteTime) {
this.voteTime = voteTime;
public void setTime(Date voteTime) {
this.time = voteTime;
}
@Override
......@@ -111,7 +111,7 @@ public class Vote implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.Vote[votesId=" + id + "]";
return "fi.insomnia.bortal.model.Vote[id=" + id + "]";
}
/**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!