create and update entities
This commit is contained in:
parent
6ad12420de
commit
d7a4a4f63d
@ -1,5 +1,6 @@
|
||||
package de.hsadmin.bo.customer;
|
||||
|
||||
import static javax.persistence.CascadeType.ALL;
|
||||
import static javax.persistence.FetchType.EAGER;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -9,12 +10,15 @@ import javax.persistence.CollectionTable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
@Entity(name = "Contact")
|
||||
@Table(name = "contact")
|
||||
@ -31,6 +35,12 @@ public class Contact implements Serializable {
|
||||
@ManyToOne(fetch = EAGER)
|
||||
private Customer customer;
|
||||
|
||||
@Column(name = "login", columnDefinition = "character varying(40)")
|
||||
private String login;
|
||||
|
||||
@Transient
|
||||
private String password;
|
||||
|
||||
@Column(name = "salut", columnDefinition = "character varying(30)")
|
||||
private String salut;
|
||||
|
||||
@ -84,6 +94,9 @@ public class Contact implements Serializable {
|
||||
@Column(name="role")
|
||||
private List<String> roles;
|
||||
|
||||
@OneToMany(fetch=FetchType.LAZY, cascade = ALL, mappedBy = "contact")
|
||||
private List<PacAdministration> pacAdminList;
|
||||
|
||||
public Contact() {
|
||||
}
|
||||
|
||||
@ -103,6 +116,22 @@ public class Contact implements Serializable {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public void setLogin(String login) {
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getSalut() {
|
||||
return salut;
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
package de.hsadmin.bo.customer;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import de.hsadmin.bo.pac.Pac;
|
||||
|
||||
@Entity
|
||||
@Table(name="pac_administration")
|
||||
public class PacAdministration {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "pac_administration_id", columnDefinition = "integer")
|
||||
private long pacAdministrationId;
|
||||
|
||||
@ManyToOne(fetch=FetchType.EAGER)
|
||||
@JoinColumn(name="contact_id")
|
||||
private Contact contact;
|
||||
|
||||
@ManyToOne(fetch=FetchType.EAGER)
|
||||
@JoinColumn(name="packet_id")
|
||||
private Pac pac;
|
||||
|
||||
public PacAdministration() {
|
||||
|
||||
}
|
||||
|
||||
public long getPacAdministrationId() {
|
||||
return pacAdministrationId;
|
||||
}
|
||||
|
||||
public void setPacAdministrationId(long pacAdministrationId) {
|
||||
this.pacAdministrationId = pacAdministrationId;
|
||||
}
|
||||
|
||||
public Contact getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
public Pac getPac() {
|
||||
return pac;
|
||||
}
|
||||
|
||||
public void setPac(Pac pac) {
|
||||
this.pac = pac;
|
||||
}
|
||||
|
||||
}
|
@ -12,7 +12,7 @@ import java.util.Set;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EntityListeners;
|
||||
// import javax.persistence.EntityListeners;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
@ -26,11 +26,12 @@ import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import de.hsadmin.bo.customer.Customer;
|
||||
import de.hsadmin.bo.customer.PacAdministration;
|
||||
|
||||
@Entity(name = "Pac")
|
||||
@Table(name = "packet")
|
||||
@SequenceGenerator(name = "PacsSeqGen", sequenceName = "packet_packet_id_seq")
|
||||
@EntityListeners({PacEntityListener.class})
|
||||
// @EntityListeners({PacEntityListener.class})
|
||||
public class Pac implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -82,6 +83,9 @@ public class Pac implements Serializable {
|
||||
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy="pac")
|
||||
private Set<UnixUser> unixUser;
|
||||
|
||||
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy="pac")
|
||||
private Set<PacAdministration> pacAdministrations;
|
||||
|
||||
public void initPacComponents(final EntityManager em, final BasePac aBasepac, final boolean setDefaults) {
|
||||
final Query qAttachedBasepac = em.createQuery("SELECT b FROM BasePac b WHERE b.valid = :valid AND b.name = :name");
|
||||
qAttachedBasepac.setParameter("valid", Boolean.TRUE);
|
||||
@ -205,6 +209,14 @@ public class Pac implements Serializable {
|
||||
this.unixUser = unixUser;
|
||||
}
|
||||
|
||||
public Set<PacAdministration> getPacAdministrations() {
|
||||
return pacAdministrations;
|
||||
}
|
||||
|
||||
public void setPacAdministrations(Set<PacAdministration> pacAdministrations) {
|
||||
this.pacAdministrations = pacAdministrations;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return super.toString() + "{ name=" + name + " }";
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
<class>de.hsadmin.bo.customer.Contact</class>
|
||||
<class>de.hsadmin.bo.customer.Customer</class>
|
||||
<class>de.hsadmin.bo.customer.SEPADirectDebit</class>
|
||||
<class>de.hsadmin.bo.customer.PacAdministration</class>
|
||||
<class>de.hsadmin.bo.domain.Domain</class>
|
||||
<class>de.hsadmin.bo.domain.DomainOption</class>
|
||||
<class>de.hsadmin.bo.domain.EMailAddress</class>
|
||||
|
Loading…
Reference in New Issue
Block a user