View Javadoc
1   package ca.uhn.fhir.jpa.entity;
2   
3   /*
4    * #%L
5    * HAPI FHIR JPA Server
6    * %%
7    * Copyright (C) 2014 - 2019 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import ca.uhn.fhir.jpa.model.entity.ResourceTable;
24  
25  import javax.persistence.*;
26  import java.util.Date;
27  
28  @Entity
29  @Table(name = "HFJ_SUBSCRIPTION_STATS", uniqueConstraints = {
30  	@UniqueConstraint(name = "IDX_SUBSC_RESID", columnNames = {"RES_ID"}),
31  })
32  public class SubscriptionTable {
33  
34  	@Temporal(TemporalType.TIMESTAMP)
35  	@Column(name = "CREATED_TIME", nullable = false, insertable = true, updatable = false)
36  	private Date myCreated;
37  
38  	@Id
39  	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_SUBSCRIPTION_ID")
40  	@SequenceGenerator(name = "SEQ_SUBSCRIPTION_ID", sequenceName = "SEQ_SUBSCRIPTION_ID")
41  	@Column(name = "PID", insertable = false, updatable = false)
42  	private Long myId;
43  
44  	@Column(name = "RES_ID", insertable = false, updatable = false)
45  	private Long myResId;
46  
47  	@OneToOne()
48  	@JoinColumn(name = "RES_ID", insertable = true, updatable = false, referencedColumnName = "RES_ID",
49  		foreignKey = @ForeignKey(name = "FK_SUBSC_RESOURCE_ID")
50  	)
51  	private ResourceTable mySubscriptionResource;
52  
53  	/**
54  	 * Constructor
55  	 */
56  	public SubscriptionTable() {
57  		super();
58  	}
59  
60  
61  	public Date getCreated() {
62  		return myCreated;
63  	}
64  
65  	public void setCreated(Date theCreated) {
66  		myCreated = theCreated;
67  	}
68  
69  	public Long getId() {
70  		return myId;
71  	}
72  
73  	public ResourceTable getSubscriptionResource() {
74  		return mySubscriptionResource;
75  	}
76  
77  	public void setSubscriptionResource(ResourceTable theSubscriptionResource) {
78  		mySubscriptionResource = theSubscriptionResource;
79  	}
80  
81  }