001/* 002 * #%L 003 * HAPI FHIR JPA Server 004 * %% 005 * Copyright (C) 2014 - 2024 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.jpa.entity; 021 022import ca.uhn.fhir.jpa.model.entity.ResourceTable; 023import jakarta.persistence.*; 024 025import java.util.Date; 026 027@Entity 028@Table( 029 name = "HFJ_SUBSCRIPTION_STATS", 030 uniqueConstraints = { 031 @UniqueConstraint( 032 name = "IDX_SUBSC_RESID", 033 columnNames = {"RES_ID"}), 034 }) 035public class SubscriptionTable { 036 037 @Temporal(TemporalType.TIMESTAMP) 038 @Column(name = "CREATED_TIME", nullable = false, insertable = true, updatable = false) 039 private Date myCreated; 040 041 @Id 042 @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_SUBSCRIPTION_ID") 043 @SequenceGenerator(name = "SEQ_SUBSCRIPTION_ID", sequenceName = "SEQ_SUBSCRIPTION_ID") 044 @Column(name = "PID", insertable = false, updatable = false) 045 private Long myId; 046 047 @Column(name = "RES_ID", insertable = false, updatable = false) 048 private Long myResId; 049 050 @OneToOne() 051 @JoinColumn( 052 name = "RES_ID", 053 insertable = true, 054 updatable = false, 055 referencedColumnName = "RES_ID", 056 foreignKey = @ForeignKey(name = "FK_SUBSC_RESOURCE_ID")) 057 private ResourceTable mySubscriptionResource; 058 059 /** 060 * Constructor 061 */ 062 public SubscriptionTable() { 063 super(); 064 } 065 066 public Date getCreated() { 067 return myCreated; 068 } 069 070 public void setCreated(Date theCreated) { 071 myCreated = theCreated; 072 } 073 074 public Long getId() { 075 return myId; 076 } 077 078 public ResourceTable getSubscriptionResource() { 079 return mySubscriptionResource; 080 } 081 082 public void setSubscriptionResource(ResourceTable theSubscriptionResource) { 083 mySubscriptionResource = theSubscriptionResource; 084 } 085}