Removed all javax source code from utils package

This commit is contained in:
Alex Huang 2012-08-08 12:56:26 -07:00
parent da26302049
commit 457f3b3dc9
77 changed files with 393 additions and 5750 deletions

View File

@ -28,6 +28,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import com.cloud.api.Identity;
import com.cloud.utils.db.Encrypt;
@Entity
@Table(name=("vpn_users"))
@ -39,25 +40,26 @@ public class VpnUserVO implements VpnUser, Identity {
@Column(name="owner_id")
private long accountId;
@Column(name="domain_id")
private long domainId;
@Column(name="username")
private String username;
@Column(name="password", encryptable=true)
@Encrypt
@Column(name="password")
private String password;
@Column(name="state")
@Enumerated(value=EnumType.STRING)
private State state;
@Column(name="uuid")
private String uuid;
public VpnUserVO() {
this.uuid = UUID.randomUUID().toString();
this.uuid = UUID.randomUUID().toString();
}
public VpnUserVO(long accountId, long domainId, String userName, String password) {
@ -66,7 +68,7 @@ public class VpnUserVO implements VpnUser, Identity {
this.username = userName;
this.password = password;
this.state = State.Add;
this.uuid = UUID.randomUUID().toString();
this.uuid = UUID.randomUUID().toString();
}
@Override
@ -78,51 +80,51 @@ public class VpnUserVO implements VpnUser, Identity {
public long getAccountId() {
return accountId;
}
@Override
@Override
public String getUsername() {
return username;
}
return username;
}
public void setUsername(String userName) {
this.username = userName;
}
public void setUsername(String userName) {
this.username = userName;
}
@Override
@Override
public String getPassword() {
return password;
}
@Override
return password;
}
@Override
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
return state;
}
public void setPassword(String password) {
this.password = password;
}
public void setState(State state) {
this.state = state;
}
@Override
public void setPassword(String password) {
this.password = password;
}
@Override
public long getDomainId() {
return domainId;
}
return domainId;
}
@Override
@Override
public String toString() {
return new StringBuilder("VpnUser[").append(id).append("-").append(username).append("-").append(accountId).append("]").toString();
}
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
return new StringBuilder("VpnUser[").append(id).append("-").append(username).append("-").append(accountId).append("]").toString();
}
@Override
public String getUuid() {
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
}

View File

@ -24,11 +24,12 @@ import javax.persistence.Id;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Table;
import com.cloud.network.security.SecurityRule.SecurityRuleType;
@Entity
@Table(name = ("security_group"))
@SecondaryTable(name = "security_group_rule", join = "left", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "id", referencedColumnName = "security_group_id") })
@SecondaryTable(name = "security_group_rule", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "id", referencedColumnName = "security_group_id") })
public class SecurityGroupRulesVO implements SecurityGroupRules {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ -58,7 +59,7 @@ public class SecurityGroupRulesVO implements SecurityGroupRules {
@Column(name = "protocol", table = "security_group_rule", insertable = false, updatable = false)
private String protocol;
@Column(name = "type", table = "security_group_rule", insertable = false, updatable = false)
private String type;
@ -130,7 +131,7 @@ public class SecurityGroupRulesVO implements SecurityGroupRules {
public String getProtocol() {
return protocol;
}
@Override
public SecurityRuleType getRuleType() {
if ("ingress".equalsIgnoreCase(this.type)) {

View File

@ -27,12 +27,13 @@ import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Table;
import com.cloud.utils.db.Encrypt;
import com.cloud.utils.db.GenericDao;
@Entity
@Table(name="user")
@SecondaryTable(name="account",
pkJoinColumns={@PrimaryKeyJoinColumn(name="account_id", referencedColumnName="id")})
pkJoinColumns={@PrimaryKeyJoinColumn(name="account_id", referencedColumnName="id")})
public class UserAccountVO implements UserAccount {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@ -63,7 +64,8 @@ public class UserAccountVO implements UserAccount {
@Column(name="api_key")
private String apiKey = null;
@Column(name="secret_key", encryptable=true)
@Encrypt
@Column(name="secret_key")
private String secretKey = null;
@Column(name=GenericDao.CREATED_COLUMN)
@ -71,13 +73,13 @@ public class UserAccountVO implements UserAccount {
@Column(name=GenericDao.REMOVED_COLUMN)
private Date removed;
@Column(name="timezone")
private String timezone;
@Column(name="registration_token")
private String registrationToken = null;
@Column(name="is_registered")
boolean registered;
@ -238,32 +240,32 @@ public class UserAccountVO implements UserAccount {
public void setAccountDisabled(String accountState) {
this.accountState = accountState;
}
@Override
public String getTimezone(){
return timezone;
public String getTimezone(){
return timezone;
}
public void setTimezone(String timezone)
{
this.timezone = timezone;
this.timezone = timezone;
}
@Override
public String getRegistrationToken(){
return registrationToken;
public String getRegistrationToken(){
return registrationToken;
}
public void setRegistrationToken(String registrationToken)
{
this.registrationToken = registrationToken;
this.registrationToken = registrationToken;
}
@Override
public boolean isRegistered() {
return registered;
}
public void setRegistered(boolean registered) {
this.registered = registered;
}

View File

@ -17,7 +17,6 @@
package com.cloud.user;
import java.util.Date;
import java.util.TimeZone;
import java.util.UUID;
import javax.persistence.Column;
@ -31,6 +30,7 @@ import javax.persistence.Table;
import com.cloud.api.Identity;
import com.cloud.user.Account.State;
import com.cloud.utils.db.Encrypt;
import com.cloud.utils.db.GenericDao;
/**
@ -72,7 +72,8 @@ public class UserVO implements User, Identity {
@Column(name = "api_key")
private String apiKey = null;
@Column(name = "secret_key", encryptable=true)
@Encrypt
@Column(name = "secret_key")
private String secretKey = null;
@Column(name = GenericDao.CREATED_COLUMN)
@ -83,25 +84,25 @@ public class UserVO implements User, Identity {
@Column(name = "timezone")
private String timezone;
@Column(name="registration_token")
private String registrationToken = null;
@Column(name="is_registered")
boolean registered;
@Column(name="uuid")
private String uuid;
public UserVO() {
this.uuid = UUID.randomUUID().toString();
this.uuid = UUID.randomUUID().toString();
}
public UserVO(long id) {
this.id = id;
this.uuid = UUID.randomUUID().toString();
this.uuid = UUID.randomUUID().toString();
}
public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone) {
this.accountId = accountId;
this.username = username;
@ -111,7 +112,7 @@ public class UserVO implements User, Identity {
this.email = email;
this.timezone = timezone;
this.state = State.enabled;
this.uuid = UUID.randomUUID().toString();
this.uuid = UUID.randomUUID().toString();
}
@Override
@ -228,22 +229,22 @@ public class UserVO implements User, Identity {
public void setTimezone(String timezone) {
this.timezone = timezone;
}
@Override
public String getRegistrationToken(){
return registrationToken;
public String getRegistrationToken(){
return registrationToken;
}
public void setRegistrationToken(String registrationToken)
{
this.registrationToken = registrationToken;
this.registrationToken = registrationToken;
}
@Override
public boolean isRegistered() {
return registered;
}
public void setRegistered(boolean registered) {
this.registered = registered;
}
@ -252,13 +253,13 @@ public class UserVO implements User, Identity {
public String toString() {
return new StringBuilder("User[").append(id).append("-").append(username).append("]").toString();
}
@Override
public String getUuid() {
return this.uuid;
return this.uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
this.uuid = uuid;
}
}

View File

@ -37,6 +37,7 @@ import javax.persistence.TemporalType;
import javax.persistence.Transient;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.db.Encrypt;
import com.cloud.utils.db.GenericDao;
import com.cloud.utils.db.StateMachine;
import com.cloud.utils.fsm.FiniteStateObject;
@ -47,20 +48,21 @@ import com.cloud.vm.VirtualMachine.State;
@Inheritance(strategy=InheritanceType.JOINED)
@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, VirtualMachine.Event> {
@Id
@Id
@TableGenerator(name="vm_instance_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_instance_seq", allocationSize=1)
@Column(name="id", updatable=false, nullable = false)
protected long id;
protected long id;
@Column(name="name", updatable=false, nullable=false, length=255)
protected String hostName = null;
protected String hostName = null;
@Column(name="vnc_password", updatable=true, nullable=false, length=255, encryptable=true)
@Encrypt
@Column(name="vnc_password", updatable=true, nullable=false, length=255)
protected String vncPassword;
@Column(name="proxy_id", updatable=true, nullable=true)
protected Long proxyId;
@Temporal(TemporalType.TIMESTAMP)
@Column(name="proxy_assign_time", updatable=true, nullable=true)
protected Date proxyAssignTime;
@ -76,20 +78,20 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
protected State state = null;
@Column(name="private_ip_address", updatable=true)
protected String privateIpAddress;
protected String privateIpAddress;
@Column(name="instance_name", updatable=true, nullable=false)
protected String instanceName;
@Column(name="vm_template_id", updatable=true, nullable=true, length=17)
protected Long templateId = new Long(-1);
protected Long templateId = new Long(-1);
@Column(name="guest_os_id", nullable=false, length=17)
protected long guestOSId;
@Column(name="host_id", updatable=true, nullable=true)
protected Long hostId;
protected Long hostId;
@Column(name="last_host_id", updatable=true, nullable=true)
protected Long lastHostId;
@ -114,29 +116,29 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
@Column(name="update_count", updatable = true, nullable=false)
protected long updated; // This field should be updated everytime the state is updated. There's no set method in the vo object because it is done with in the dao code.
@Column(name=GenericDao.CREATED_COLUMN)
protected Date created;
@Column(name=GenericDao.REMOVED_COLUMN)
protected Date removed;
@Column(name="update_time", updatable=true)
@Temporal(value=TemporalType.TIMESTAMP)
protected Date updateTime;
@Column(name="domain_id")
protected long domainId;
@Column(name="account_id")
protected long accountId;
@Column(name="service_offering_id")
protected long serviceOfferingId;
@Column(name="reservation_id")
protected String reservationId;
@Column(name="hypervisor_type")
@Enumerated(value=EnumType.STRING)
protected HypervisorType hypervisorType;
@ -146,19 +148,19 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
@Column(name="uuid")
protected String uuid = UUID.randomUUID().toString();
;
;
public VMInstanceVO(long id,
long serviceOfferingId,
String name,
String instanceName,
Type type,
Long vmTemplateId,
HypervisorType hypervisorType,
long guestOSId,
long domainId,
long accountId,
boolean haEnabled) {
long serviceOfferingId,
String name,
String instanceName,
Type type,
Long vmTemplateId,
HypervisorType hypervisorType,
long guestOSId,
long domainId,
long accountId,
boolean haEnabled) {
this.id = id;
this.hostName = name != null ? name : this.uuid;
if (vmTemplateId != null) {
@ -189,177 +191,177 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
long accountId,
boolean haEnabled,
boolean limitResourceUse) {
this(id, serviceOfferingId, name, instanceName, type, vmTemplateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
this(id, serviceOfferingId, name, instanceName, type, vmTemplateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
this.limitCpuUse = limitResourceUse;
}
protected VMInstanceVO() {
}
public Date getRemoved() {
return removed;
return removed;
}
@Override
public long getDomainId() {
return domainId;
}
@Override
public long getAccountId() {
return accountId;
}
@Override
public Type getType() {
return type;
}
public long getUpdated() {
return updated;
}
@Override
public long getId() {
return id;
}
@Override
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public long getUpdated() {
return updated;
}
@Override
public long getId() {
return id;
}
@Override
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public HypervisorType getHypervisorType() {
return hypervisorType;
}
@Override
return hypervisorType;
}
@Override
public Date getCreated() {
return created;
}
public Date getUpdateTime() {
return updateTime;
}
@Override
return created;
}
public Date getUpdateTime() {
return updateTime;
}
@Override
public long getDataCenterIdToDeployIn() {
return dataCenterIdToDeployIn;
}
@Override
public String getHostName() {
return hostName;
}
@Override
public String getInstanceName() {
return instanceName;
}
@Override
public State getState() {
return state;
}
// don't use this directly, use VM state machine instead, this method is added for migration tool only
@Override
return dataCenterIdToDeployIn;
}
@Override
public String getHostName() {
return hostName;
}
@Override
public String getInstanceName() {
return instanceName;
}
@Override
public State getState() {
return state;
}
// don't use this directly, use VM state machine instead, this method is added for migration tool only
@Override
public void setState(State state) {
this.state = state;
}
@Override
public String getPrivateIpAddress() {
return privateIpAddress;
}
public void setPrivateIpAddress(String address) {
privateIpAddress = address;
}
this.state = state;
}
@Override
public String getPrivateIpAddress() {
return privateIpAddress;
}
public void setPrivateIpAddress(String address) {
privateIpAddress = address;
}
public void setVncPassword(String vncPassword) {
this.vncPassword = vncPassword;
}
@Override
public String getVncPassword() {
return vncPassword;
}
@Override
public long getServiceOfferingId() {
return serviceOfferingId;
}
public Long getProxyId() {
return proxyId;
public Long getProxyId() {
return proxyId;
}
public void setProxyId(Long proxyId) {
this.proxyId = proxyId;
this.proxyId = proxyId;
}
public Date getProxyAssignTime() {
return this.proxyAssignTime;
return this.proxyAssignTime;
}
public void setProxyAssignTime(Date time) {
this.proxyAssignTime = time;
this.proxyAssignTime = time;
}
@Override
public long getTemplateId() {
if (templateId == null) {
@Override
public long getTemplateId() {
if (templateId == null) {
return -1;
} else {
return templateId;
}
}
public void setTemplateId(Long templateId) {
this.templateId = templateId;
}
}
@Override
public void setTemplateId(Long templateId) {
this.templateId = templateId;
}
@Override
public long getGuestOSId() {
return guestOSId;
}
public void setGuestOSId(long guestOSId) {
this.guestOSId = guestOSId;
}
return guestOSId;
}
public void incrUpdated() {
updated++;
}
public void decrUpdated() {
updated--;
}
public void setGuestOSId(long guestOSId) {
this.guestOSId = guestOSId;
}
public void incrUpdated() {
updated++;
}
public void decrUpdated() {
updated--;
}
@Override
public Long getHostId() {
return hostId;
}
@Override
public Long getLastHostId() {
return lastHostId;
}
@Override
public Long getHostId() {
return hostId;
}
@Override
public Long getLastHostId() {
return lastHostId;
}
public void setLastHostId(Long lastHostId) {
this.lastHostId = lastHostId;
}
public void setHostId(Long hostId) {
this.hostId = hostId;
}
this.lastHostId = lastHostId;
}
public void setHostId(Long hostId) {
this.hostId = hostId;
}
@Override
public boolean isHaEnabled() {
return haEnabled;
@ -371,7 +373,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
}
public void setLimitCpuUse(boolean value) {
limitCpuUse = value;
limitCpuUse = value;
}
@Override
@ -383,7 +385,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
public Long getPodIdToDeployIn() {
return podIdToDeployIn;
}
public void setPodId(long podId) {
this.podIdToDeployIn = podId;
}
@ -395,70 +397,71 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
public void setDataCenterId(long dataCenterId) {
this.dataCenterIdToDeployIn = dataCenterId;
}
public boolean isRemoved() {
return removed != null;
}
public void setHaEnabled(boolean value) {
haEnabled = value;
}
public void setReservationId(String reservationId) {
this.reservationId = reservationId;
}
public String getReservationId() {
return this.reservationId;
}
public void setReservationId(String reservationId) {
this.reservationId = reservationId;
}
public String getReservationId() {
return this.reservationId;
}
@Override
public Map<String, String> getDetails() {
return details;
}
public void setDetail(String name, String value) {
assert (details != null) : "Did you forget to load the details?";
details.put(name, value);
}
public void setDetails(Map<String, String> details) {
this.details = details;
}
transient String toString;
transient String toString;
@Override
public String toString() {
public String toString() {
if (toString == null) {
toString = new StringBuilder("VM[").append(type.toString()).append("|").append(hostName).append("]").toString();
}
return toString;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (id ^ (id >>> 32));
return result;
}
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (id ^ (id >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VMInstanceVO other = (VMInstanceVO) obj;
if (id != other.id)
return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VMInstanceVO other = (VMInstanceVO) obj;
if (id != other.id)
return false;
return true;
}
public void setServiceOfferingId(long serviceOfferingId) {
this.serviceOfferingId = serviceOfferingId;
}

View File

@ -27,6 +27,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import com.cloud.api.Identity;
import com.cloud.utils.db.Encrypt;
/**
* CiscoNexusVSMDeviceVO contains information on external Cisco Nexus 1000v VSM devices added into a deployment.
@ -37,176 +38,192 @@ import com.cloud.api.Identity;
@Entity
@Table(name="virtual_supervisor_module")
public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice, Identity{
// We need to know what properties a VSM has. Put them here.
// We need to know what properties a VSM has. Put them here.
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@Column(name="uuid")
private String uuid;
private final String uuid;
@Column(name = "host_id")
private long hostId;
@Column(name = "vsm_name")
private String vsmName;
@Column(name = "username")
private String vsmUserName;
@Column(name = "password", encryptable=true)
@Encrypt
@Column(name = "password")
private String vsmPassword;
@Column(name = "ipaddr")
private String ipaddr;
@Column(name = "management_vlan")
private int managementVlan;
@Column(name = "control_vlan")
private int controlVlan;
@Column(name = "packet_vlan")
private int packetVlan;
@Column(name = "storage_vlan")
private int storageVlan;
@Column(name = "vsm_domain_id")
private long vsmDomainId;
@Column(name = "config_mode")
private VSMConfigMode vsmConfigMode;
@Column(name = "config_state")
private VSMConfigState vsmConfigState;
@Column(name = "vsm_device_state")
private VSMDeviceState vsmDeviceState;
// Accessor methods
@Override
public long getId() {
return id;
}
@Override
public String getvsmName() {
return vsmName;
return vsmName;
}
@Override
public long getHostId() {
return hostId;
}
@Override
public String getUserName() {
return vsmUserName;
}
public String getPassword() {
return vsmPassword;
return vsmUserName;
}
@Override
public String getPassword() {
return vsmPassword;
}
@Override
public String getipaddr() {
return ipaddr;
return ipaddr;
}
@Override
public int getManagementVlan() {
return managementVlan;
return managementVlan;
}
@Override
public int getControlVlan() {
return controlVlan;
return controlVlan;
}
@Override
public int getPacketVlan() {
return packetVlan;
return packetVlan;
}
@Override
public int getStorageVlan() {
return storageVlan;
return storageVlan;
}
@Override
public long getvsmDomainId() {
return vsmDomainId;
return vsmDomainId;
}
@Override
public VSMConfigMode getvsmConfigMode() {
return vsmConfigMode;
return vsmConfigMode;
}
@Override
public VSMConfigState getvsmConfigState() {
return vsmConfigState;
return vsmConfigState;
}
@Override
public VSMDeviceState getvsmDeviceState() {
return vsmDeviceState;
return vsmDeviceState;
}
@Override
public String getUuid() {
return uuid;
}
// Setter methods
public void setHostId(long hostid) {
this.hostId = hostid;
}
public void setVsmUserName(String username) {
this.vsmUserName = username;
this.vsmUserName = username;
}
public void setVsmName(String vsmName) {
this.vsmName = vsmName;
this.vsmName = vsmName;
}
public void setVsmPassword(String password) {
this.vsmPassword = password;
this.vsmPassword = password;
}
public void setMgmtIpAddr(String ipaddr) {
this.ipaddr = ipaddr;
this.ipaddr = ipaddr;
}
public void setManagementVlan(int vlan) {
this.managementVlan = vlan;
this.managementVlan = vlan;
}
public void setControlVlan(int vlan) {
this.controlVlan = vlan;
this.controlVlan = vlan;
}
public void setPacketVlan(int vlan) {
this.packetVlan = vlan;
this.packetVlan = vlan;
}
public void setStorageVlan(int vlan) {
this.storageVlan = vlan;
this.storageVlan = vlan;
}
public void setVsmDomainId(long id) {
this.vsmDomainId = id;
this.vsmDomainId = id;
}
public void setVsmConfigMode(VSMConfigMode mode) {
this.vsmConfigMode = mode;
this.vsmConfigMode = mode;
}
public void setVsmConfigState(VSMConfigState state) {
this.vsmConfigState = state;
this.vsmConfigState = state;
}
public void setVsmDeviceState(VSMDeviceState devState) {
this.vsmDeviceState = devState;
this.vsmDeviceState = devState;
}
// Constructors.
public CiscoNexusVSMDeviceVO(String vsmIpAddr, String username, String password) {
// Set all the VSM's properties here.
// Set all the VSM's properties here.
this.uuid = UUID.randomUUID().toString();
this.setMgmtIpAddr(vsmIpAddr);
this.setVsmUserName(username);
@ -214,7 +231,7 @@ public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice, Identity{
this.setVsmName(vsmName);
this.setVsmDeviceState(VSMDeviceState.Enabled);
}
public CiscoNexusVSMDeviceVO() {
this.uuid = UUID.randomUUID().toString();
}

View File

@ -23,6 +23,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.cloud.utils.db.Encrypt;
@Entity
@Table(name="account_details")
public class AccountDetailVO {
@ -30,25 +32,26 @@ public class AccountDetailVO {
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="account_id")
private long accountId;
@Column(name="name")
private String name;
@Column(name="value", encryptable=true)
@Encrypt
@Column(name="value")
private String value;
protected AccountDetailVO() {
}
public AccountDetailVO(long accountId, String name, String value) {
this.accountId = accountId;
this.name = name;
this.value = value;
}
public long getAccountId() {
return accountId;
}

View File

@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
@ -24,5 +6,7 @@ under the License.
<classpathentry combineaccessrules="false" kind="src" path="/deps"/>
<classpathentry combineaccessrules="false" kind="src" path="/tools"/>
<classpathentry exported="true" kind="lib" path="/deps/cloud-log4j.jar"/>
<classpathentry exported="true" kind="lib" path="/deps/cloud-ejb-api-3.0.jar"/>
<classpathentry exported="true" kind="lib" path="/deps/cloud-javax.persistence-2.0.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -120,7 +120,7 @@ public class Attribute {
flags = Flag.AutoGV.setTrue(flags);
}
}
if (isEmbedded) {
flags = Flag.Embedded.setTrue(flags);
}
@ -144,7 +144,8 @@ public class Attribute {
if (column == null || column.nullable()) {
flags = Flag.Nullable.setTrue(flags);
}
if (column != null && column.encryptable()) {
Encrypt encrypt = field.getAnnotation(Encrypt.class);
if (encrypt != null && encrypt.encrypt()) {
flags = Flag.Encrypted.setTrue(flags);
}
}
@ -207,7 +208,7 @@ public class Attribute {
public final boolean isEncrypted() {
return Flag.Encrypted.check(flags);
}
public Field getField() {
return field;
}

View File

@ -499,7 +499,8 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
byte[] bytes = rs.getBytes(index);
if(bytes != null) {
try {
if(field.getAnnotation(Column.class).encryptable()){
Encrypt encrypt = field.getAnnotation(Encrypt.class);
if (encrypt != null && encrypt.encrypt()){
field.set(entity, DBEncryptionUtil.decrypt(new String(bytes, "UTF-8")));
} else {
field.set(entity, new String(bytes, "UTF-8"));

View File

@ -134,7 +134,7 @@ public class SqlGenerator {
}
Attribute attr = new Attribute(clazz, overrides, field, tableName, embedded, isId);
if (attr.getColumnName().equals(GenericDao.REMOVED_COLUMN)) {
attr.setColumnName(GenericDao.REMOVED);
attr.setTrue(Attribute.Flag.DaoGenerated);
@ -279,7 +279,7 @@ public class SqlGenerator {
public Attribute findAttribute(String name) {
for (Attribute attr : _attributes) {
if (attr.columnName.equalsIgnoreCase(name)) {
if (attr.columnName.equalsIgnoreCase(GenericDao.REMOVED) && attr.isUpdatable()) {
return null;
@ -315,8 +315,8 @@ public class SqlGenerator {
}
if (attrs.size() != 0) {
Pair<StringBuilder, Attribute[]> pair =
new Pair<StringBuilder, Attribute[]>(buildUpdateSql(tableName, attrs), attrs.toArray(new Attribute[attrs.size()]));
sqls.add(pair);
new Pair<StringBuilder, Attribute[]>(buildUpdateSql(tableName, attrs), attrs.toArray(new Attribute[attrs.size()]));
sqls.add(pair);
}
}
return sqls;
@ -539,7 +539,7 @@ public class SqlGenerator {
SecondaryTable[] sts = DbUtil.getSecondaryTables(clazz);
ArrayList<String> secondaryTables = new ArrayList<String>();
for (SecondaryTable st : sts) {
addPrimaryKeyJoinColumns(innerJoin, tableName, st.name(), st.join(), st.pkJoinColumns());
addPrimaryKeyJoinColumns(innerJoin, tableName, st.name(), "", st.pkJoinColumns());
secondaryTables.add(st.name());
}
@ -566,7 +566,7 @@ public class SqlGenerator {
public Pair<StringBuilder, Attribute[]> buildSelectSql(boolean enable_query_cache) {
StringBuilder sql = new StringBuilder("SELECT ");
sql.append(enable_query_cache ? "SQL_CACHE ": "");
ArrayList<Attribute> attrs = new ArrayList<Attribute>();

View File

@ -1,56 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.ejb;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
/**
* When used on the bean class, declares the local business interface(s)
* for a session bean. When used on an interface, designates that interface
* as a local business interface. In this case, no value() is provided.
*
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Local {
Class[] value() default {};
}

View File

@ -1,97 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation is used to override a many-to-one or
* one-to-one mapping of property or field for an entity relationship.
*
* <p> The <code>AssociationOverride</code> annotation may be applied
* to an entity that extends a mapped superclass to override a many-to-one
* or one-to-one mapping defined by the mapped superclass. If the
* <code>AssociationOverride</code> annotation is not specified, the join
* column is mapped the same as in the original mapping.
* <pre>
* Example:
* &#064;MappedSuperclass
* public class Employee {
* ...
* &#064;ManyToOne
* protected Address address;
* ...
* }
*
* &#064;Entity
* &#064;AssociationOverride(name="address",
* joinColumns=&#064;JoinColumn(name="ADDR_ID"))
* // address field mapping overridden to ADDR_ID fk
* public class PartTimeEmployee extends Employee {
* ...
* }
* </pre>
*
* @see OneToOne
* @see ManyToOne
* @see MappedSuperclass
*
* @since Java Persistence 1.0
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface AssociationOverride {
/**
* The name of the relationship property whose mapping is
* being overridden if property-based access is being used,
* or the name of the relationship field if field-based access is used.
*/
String name();
/**
* The join column that is being mapped to the persistent
* attribute. The mapping type will remain the same as is defined
* in the mapped superclass.
*/
JoinColumn[] joinColumns();
}

View File

@ -1,88 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation is used to override mappings of multiple
* many-to-one or one-to-one relationship properties or fields.
*
* <pre>
*
* Example:
* &#064;MappedSuperclass
* public class Employee {
*
* &#064;Id protected Integer id;
* &#064;Version protected Integer version;
* &#064;ManyToOne protected Address address;
* &#064;OneToOne protected Locker locker;
*
* public Integer getId() { ... }
* public void setId(Integer id) { ... }
* public Address getAddress() { ... }
* public void setAddress(Address address) { ... }
* public Locker getLocker() { ... }
* public void setLocker(Locker locker) { ... }
*
* }
*
* &#064;Entity
* &#064;AssociationOverrides({
*
* &#064;AssociationOverride(name="address",
* joinColumns=&#064;JoinColumn("ADDR_ID")),
* &#064;AttributeOverride(name="locker",
* joinColumns=&#064;JoinColumn("LCKR_ID"))})
* public PartTimeEmployee { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface AssociationOverrides {
/** Mapping overrides of relationship properties or fields */
AssociationOverride[] value();
}

View File

@ -1,105 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* The <code>AttributeOverride</code> annotation is used to
* override the mapping of a {@link Basic} (whether explicit or
* default) property or field or Id property or field.
*
* <p> The <code>AttributeOverride</code> annotation may be
* applied to an entity that extends a mapped superclass or to
* an embedded field or property to override a basic mapping
* defined by the mapped superclass or embeddable class. If the
* <code>AttributeOverride</code> annotation is not specified,
* the column is mapped the same as in the original mapping.
*
* <pre>
* <p> Example:
*
* &#064;MappedSuperclass
* public class Employee {
* &#064;Id protected Integer id;
* &#064;Version protected Integer version;
* protected String address;
* public Integer getId() { ... }
* public void setId(Integer id) { ... }
* public String getAddress() { ... }
* public void setAddress(String address) { ... }
* }
*
* &#064;Entity
* &#064;AttributeOverride(name="address", column=&#064;Column(name="ADDR"))
* public class PartTimeEmployee extends Employee {
* // address field mapping overridden to ADDR
* protected Float wage();
* public Float getHourlyWage() { ... }
* public void setHourlyWage(Float wage) { ... }
* }
* </pre>
*
* @see Embedded
* @see Embeddable
* @see MappedSuperclass
*
* @since Java Persistence 1.0
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface AttributeOverride {
/**
* (Required) The name of the property whose mapping is being
* overridden if property-based access is being used, or the
* name of the field if field-based access is used.
*/
String name();
/**
* (Required) The column that is being mapped to the persistent
* attribute. The mapping type will remain the same as is
* defined in the embeddable class or mapped superclass.
*/
Column column();
}

View File

@ -1,70 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to override mappings of multiple properties or fields.
*
* <pre>
*
* Example:
*
* &#064;Embedded
* &#064;AttributeOverrides({
* &#064;AttributeOverride(name="startDate", column=&#064;Column("
* EMP_START")),
* &#064;AttributeOverride(name="endDate", column=&#064;Column("EMP_END"))
* })
* public EmploymentPeriod getEmploymentPeriod() { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface AttributeOverrides {
/** One or more mapping override */
AttributeOverride[] value();
}

View File

@ -1,86 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.FetchType.EAGER;
/**
* The <code>Basic</code> annotation is the simplest type of mapping
* to a database column. The <code>Basic</code> annotation can be
* applied to a persistent property or instance variable of any of the
* following types: Java primitive types, wrappers of the primitive types,
* {@link String}, {@link java.math.BigInteger java.math.BigInteger},
* {@link java.math.BigDecimal java.math.BigDecimal},
* {@link java.util.Date java.util.Date},
* {@link java.util.Calendar java.util.Calendar},
* {@link java.sql.Date java.sql.Date}, {@link java.sql.Time java.sql.Time},
* {@link java.sql.Timestamp java.sql.Timestamp}, <code>byte[], Byte[],
* char[], Character[]</code>, enums, and any other type that implements
* {@link java.io.Serializable Serializable}.
*
* <p> The use of the <code>Basic</code> annotation is optional for
* persistent fields and properties of these types.
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Basic {
/**
* (Optional) Defines whether the value of the field or property should
* be lazily loaded or must be eagerly fetched. The <code>EAGER</code>
* strategy is a requirement on the persistence provider runtime
* that the value must be eagerly fetched. The <code>LAZY</code>
* strategy is a hint to the persistence provider runtime.
* If not specified, defaults to <code>EAGER</code>.
*/
FetchType fetch() default EAGER;
/**
* (Optional) Defines whether the value of the field or property may be null.
* This is a hint and is disregarded for primitive types; it may
* be used in schema generation.
* If not specified, defaults to <code>true</code>.
*/
boolean optional() default true;
}

View File

@ -1,62 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Defines the set of cascadable operations that are propagated
* to the associated entity.
* The value <code>cascade=ALL<code> is equivalent to
* <code>cascade={PERSIST, MERGE, REMOVE, REFRESH}</code>.
*
* @since Java Persistence 1.0
*/
public enum CascadeType {
/** Cascade all operations */
ALL,
/** Cascade persist operation */
PERSIST,
/** Cascade merge operation */
MERGE,
/** Cascade remove operation */
REMOVE,
/** Cascade refresh operation */
REFRESH
}

View File

@ -1,22 +0,0 @@
package javax.persistence;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = { METHOD, FIELD })
@Retention(value = RetentionPolicy.RUNTIME)
public @interface CollectionTable {
String catalog() default "";
JoinColumn[] joinColumns() default {};
String name() default "";
String schema() default "";
UniqueConstraint[] uniqueConstraints() default {};
}

View File

@ -1,144 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to specify a mapped column for a persistent property or field.
* If no Column annotation is specified, the default values are applied.
* <p> Examples:
*
* <blockquote><pre>
* Example 1:
* &#064;Column(name="DESC", nullable=false, length=512)
* public String getDescription() { return description; }
*
* Example 2:
* &#064;Column(name="DESC",
* columnDefinition="CLOB NOT NULL",
* table="EMP_DETAIL")
* &#064;Lob
* public String getDescription() { return description; }
*
* Example 3:
* &#064;Column(name="ORDER_COST", updatable=false, precision=12, scale=2)
* public BigDecimal getCost() { return cost; }
*
* </pre></blockquote>
*
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Column {
/**
* (Optional) The name of the column. Defaults to
* the property or field name.
*/
String name() default "";
/**
* (Optional) Whether the property is a unique key. This is a
* shortcut for the UniqueConstraint annotation at the table
* level and is useful for when the unique key constraint is
* only a single field. This constraint applies in addition
* to any constraint entailed by primary key mapping and
* to constraints specified at the table level.
*/
boolean unique() default false;
/**
* (Optional) Whether the database column is nullable.
*/
boolean nullable() default true;
/**
* (Optional) Whether the column is included in SQL INSERT
* statements generated by the persistence provider.
*/
boolean insertable() default true;
/**
* (Optional) Whether the column is included in SQL UPDATE
* statements generated by the persistence provider.
*/
boolean updatable() default true;
/**
* (Optional) The SQL fragment that is used when
* generating the DDL for the column.
* <p> Defaults to the generated SQL to create a
* column of the inferred type.
*/
String columnDefinition() default "";
/**
* (Optional) The name of the table that contains the column.
* If absent the column is assumed to be in the primary table.
*/
String table() default "";
/**
* (Optional) The column length. (Applies only if a
* string-valued column is used.)
*/
int length() default 255;
/**
* (Optional) The precision for a decimal (exact numeric)
* column. (Applies only if a decimal column is used.)
* Value must be set by developer if used when generating
* the DDL for the column.
*/
int precision() default 0;
/**
* (Optional) The scale for a decimal (exact numeric) column.
* (Applies only if a decimal column is used.)
*/
int scale() default 0;
/**
* (Optional) Whether encryption should be used for this column
*/
boolean encryptable() default false;
}

View File

@ -1,80 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* References name of a column in the SELECT clause of a SQL query -
* i.e., column alias, if applicable. Scalar result types can be
* included in the query result by specifying this annotation in
* the metadata.
*
* <pre>
*
* Example:
* Query q = em.createNativeQuery(
* "SELECT o.id AS order_id, " +
* "o.quantity AS order_quantity, " +
* "o.item AS order_item, " +
* "i.name AS item_name, " +
* "FROM Order o, Item i " +
* "WHERE (order_quantity > 25) AND (order_item = i.id)",
* "OrderResults");
*
* &#064;SqlResultSetMapping(name="OrderResults",
* entities={
* &#064;EntityResult(entityClass=com.acme.Order.class, fields={
* &#064;FieldResult(name="id", column="order_id"),
* &#064;FieldResult(name="quantity", column="order_quantity"),
* &#064;FieldResult(name="item", column="order_item")})},
* columns={
* &#064;ColumnResult(name="item_name")}
* )
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({})
@Retention(RUNTIME)
public @interface ColumnResult {
/** The name of a column in the SELECT clause of a SQL query */
String name();
}

View File

@ -1,101 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.DiscriminatorType.STRING;
/**
* Is used to define the discriminator column for the
* {@link InheritanceType#SINGLE_TABLE SINGLE_TABLE} and
* {@link InheritanceType#JOINED JOINED} inheritance mapping strategies.
*
* <p> The strategy and the discriminator column are only
* specified in the root of an entity class hierarchy or
* subhierarchy in which a different inheritance strategy is applied
*
* <p> If the <code>DiscriminatorColumn</code> annotation is missing,
* and a discriminator column is required, the name of the
* discriminator column defaults to <code>"DTYPE"</code> and the discriminator
* type to {@link DiscriminatorType#STRING DiscriminatorType.STRING}.
*
* <pre>
* Example:
* &#064;Entity
* &#064;Table(name="CUST")
* &#064;Inheritance(strategy=SINGLE_TABLE)
* &#064;DiscriminatorColumn(name="DISC", discriminatorType=STRING,length=20)
* public class Customer { ... }
*
* &#064;Entity
* public class ValuedCustomer extends Customer { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface DiscriminatorColumn {
/**
* (Optional) The name of column to be used for the discriminator.
*/
String name() default "DTYPE";
/**
* (Optional) The type of object/column to use as a class discriminator.
* Defaults to {@link DiscriminatorType#STRING DiscriminatorType.STRING}.
*/
DiscriminatorType discriminatorType() default STRING;
/**
* (Optional) The SQL fragment that is used when generating the DDL
* for the discriminator column.
* <p> Defaults to the provider-generated SQL to create a column
* of the specified discriminator type.
*/
String columnDefinition() default "";
/**
* (Optional) The column length for String-based discriminator types.
* Ignored for other discriminator types.
*/
int length() default 31;
}

View File

@ -1,53 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Defines supported types of the discriminator column.
*
* @since Java Persistence 1.0
*/
public enum DiscriminatorType {
/** String as the discriminator type */
STRING,
/** Single character as the discriminator type */
CHAR,
/** Integer as the discriminator type */
INTEGER
}

View File

@ -1,95 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to specify the value of the discriminator column for
* entities of the given type. The <code>DiscriminatorValue</code>
* annotation can only be specified on a concrete entity
* class. If the <code>DiscriminatorValue</code> annotation is not
* specified and a discriminator column is used, a provider-specific
* function will be used to generate a value representing the
* entity type. If the {@link DiscriminatorType} is {@link
* DiscriminatorType#STRING STRING}, the discriminator value
* default is the entity name.
*
* <p> The inheritance strategy and the discriminator column
* are only specified in the root of an entity class hierarchy
* or subhierarchy in which a different inheritance strategy is
* applied. The discriminator value, if not defaulted, should be
* specified for each entity class in the hierarchy.
*
* <pre>
*
* Example:
*
* &#064;Entity
* &#064;Table(name="CUST")
* &#064;Inheritance(strategy=SINGLE_TABLE)
* &#064;DiscriminatorColumn(name="DISC", discriminatorType=STRING,length=20)
* &#064;DiscriminatorValue("CUSTOMER")
* public class Customer { ... }
*
* &#064;Entity
* &#064;DiscriminatorValue("VCUSTOMER")
* public class ValuedCustomer extends Customer { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface DiscriminatorValue {
/**
* (Optional) The value that indicates that the
* row is an entity of the annotated entity type.
*
* <p> If the <code>DiscriminatorValue</code> annotation is not
* specified and a discriminator column is used, a provider-specific
* function will be used to generate a value representing the
* entity type. If the DiscriminatorType is {@link
* DiscriminatorType#STRING STRING}, the discriminator value
* default is the entity name.
*/
String value();
}

View File

@ -1,16 +0,0 @@
package javax.persistence;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = { METHOD, FIELD })
@Retention(value = RetentionPolicy.RUNTIME)
public @interface ElementCollection {
FetchType fetch() default FetchType.LAZY;
Class<?> targetClass() default void.class;
}

View File

@ -1,62 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Defines a class whose instances are stored as an intrinsic
* part of an owning entity and share the identity of the entity.
* Each of the persistent properties or fields of the embedded
* object is mapped to the database table for the entity. Only
* {@link Basic}, {@link Column}, {@link Lob},
* {@link Temporal}, and {@link Enumerated} mapping
* annotations may portably be used to map the persistent fields
* or properties of classes annotated as {@link Embeddable}.
*
* <p> Note that the {@link Transient} annotation may be used to
* designate the non-persistent state of an embeddable class.
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface Embeddable {
}

View File

@ -1,67 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Defines a persistent field or property of an entity whose
* value is an instance of an embeddable class. The embeddable
* class must be annotated as {@link Embeddable}.
*
* <pre>
* Example:
*
* &#064;Embedded
* &#064;AttributeOverrides({
* &#064;AttributeOverride(name="startDate",
* column=&#064;Column("EMP_START")),
* &#064;AttributeOverride(name="endDate", column=&#064;Column("EMP_END"))
* })
* public EmploymentPeriod getEmploymentPeriod() { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Embedded {
}

View File

@ -1,62 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is applied to a persistent field or property of an entity
* class or mapped superclass to denote a composite primary
* key that is an embeddable class. The embeddable class
* must be annotated as {@link Embeddable}.
*
* <pre>
* Example:
*
* &#064;EmbeddedId
* protected EmployeePK empPK;
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface EmbeddedId {}

View File

@ -1,59 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Specifies that the class is an entity. This annotation is
* applied to the entity class.
*
* @since Java Persistence 1.0
*/
@Target(TYPE)
@Retention(RUNTIME)
public @interface Entity {
/** The name of an entity. Defaults to the unqualified
* name of the entity class. This name is used to
* refer to the entity in queries. The name must not be
* a reserved literal in the Java Persistence query language. */
String name() default "";
}

View File

@ -1,87 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Thrown by the persistence provider when {@link EntityManager#persist(Object)
* EntityManager.persist(Object)} is called and the entity
* already exists. The current transaction, if one is active,
* will be marked for rollback.
*
* @see javax.persistence.EntityManager#persist(Object)
*
* @since Java Persistence 1.0
*/
@SuppressWarnings("serial")
public class EntityExistsException extends PersistenceException {
/**
* Constructs a new <code>EntityExistsException</code> exception
* with <code>null</code> as its detail message.
*/
public EntityExistsException() {
super();
}
/**
* Constructs a new <code>EntityExistsException</code> exception
* with the specified detail message.
* @param message the detail message.
*/
public EntityExistsException(String message) {
super(message);
}
/**
* Constructs a new <code>EntityExistsException</code> exception
* with the specified detail message and cause.
* @param message the detail message.
* @param cause the cause.
*/
public EntityExistsException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new <code>EntityExistsException</code> exception
* with the specified cause.
* @param cause the cause.
*/
public EntityExistsException(Throwable cause) {
super(cause);
}
};

View File

@ -1,57 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Specifies the callback listener classes to be used for an
* entity or mapped superclass. This annotation may be applied
* to an entity class or mapped superclass.
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface EntityListeners {
/** The callback listener classes */
Class[] value();
}

View File

@ -1,71 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Thrown by the persistence provider when an entity reference obtained by
* {@link EntityManager#getReference EntityManager.getReference(Class,Object)}
* is accessed but the entity does not exist. Also thrown when
* {@link EntityManager#refresh EntityManager.refresh(Object)} is called
* and the object no longer exists in the database. The
* current transaction, if one is active, will be marked for rollback.
*
* @see javax.persistence.EntityManager#getReference(Class,Object)
* @see javax.persistence.EntityManager#refresh(Object)
*
* @since Java Persistence 1.0
*/
@SuppressWarnings("serial")
public class EntityNotFoundException extends PersistenceException {
/**
* Constructs a new <code>EntityNotFoundException</code> exception
* with <code>null</code> as its detail message.
*/
public EntityNotFoundException() {
super();
}
/**
* Constructs a new <code>EntityNotFoundException</code> exception
* with the specified detail message.
* @param message the detail message.
*/
public EntityNotFoundException(String message) {
super(message);
}
};

View File

@ -1,86 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* References an entity in the SELECT clause of a SQL query.
* If this annotation is used, the SQL statement should select
* all of the columns that are mapped to the entity object.
* This should include foreign key columns to related entities.
* The results obtained when insufficient data is available
* are undefined.
*
* <pre>
* Example
* Query q = em.createNativeQuery(
* "SELECT o.id, o.quantity, o.item, i.id, i.name, i.description "+
* "FROM Order o, Item i " +
* "WHERE (o.quantity > 25) AND (o.item = i.id)",
* "OrderItemResults");
* &#064;SqlResultSetMapping(name="OrderItemResults",
* entities={
* &#064;EntityResult(entityClass=com.acme.Order.class),
* &#064;EntityResult(entityClass=com.acme.Item.class)
* })
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({})
@Retention(RUNTIME)
public @interface EntityResult {
/** The class of the result */
Class entityClass();
/**
* Maps the columns specified in the SELECT list of the
* query to the properties or fields of the entity class.
*/
FieldResult[] fields() default {};
/**
* Specifies the column name (or alias) of the column in
* the SELECT list that is used to determine the type of
* the entity instance.
*/
String discriminatorColumn() default "";
}

View File

@ -1,90 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* The <code>EntityTransaction</code> interface is used to control
* resource transactions on resource-local entity managers. The
* {@link EntityManager#getTransaction EntityManager.getTransaction()}
* method returns the <code>EntityTransaction</code> interface.
*
* @since Java Persistence 1.0
*/
public interface EntityTransaction {
/**
* Start the resource transaction.
* @throws IllegalStateException if {@link #isActive()} is true.
*/
public void begin();
/**
* Commit the current transaction, writing any unflushed
* changes to the database.
* @throws IllegalStateException if {@link #isActive()} is false.
* @throws RollbackException if the commit fails.
*/
public void commit();
/**
* Roll back the current transaction
* @throws IllegalStateException if {@link #isActive()} is false.
* @throws PersistenceException if an unexpected error
* condition is encountered.
*/
public void rollback();
/**
* Mark the current transaction so that the only possible
* outcome of the transaction is for the transaction to be
* rolled back.
* @throws IllegalStateException if {@link #isActive()} is false.
*/
public void setRollbackOnly();
/**
* Determine whether the current transaction has been marked
* for rollback.
* @throws IllegalStateException if {@link #isActive()} is false.
*/
public boolean getRollbackOnly();
/**
* Indicate whether a transaction is in progress.
* @throws PersistenceException if an unexpected error
* condition is encountered.
*/
public boolean isActive();
}

View File

@ -1,51 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Defines mapping for the enumerated types.
* The constants of this enumerated type specify how persistent
* property or field should be persisted as a enumerated type.
*
* @since Java Persistence 1.0
*/
public enum EnumType {
/** Persist enumerated type property or field as an integer */
ORDINAL,
/** Persist enumerated type property or field as a string */
STRING
}

View File

@ -1,73 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.EnumType.ORDINAL;
/**
* Specifies that a persistent property or field should be
* persisted as a enumerated type. It may be used in conjunction
* with the {@link Basic} annotation.
*
* <pre>
* Example:
*
* public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT}
*
* public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}
*
* &#064;Entity public class Employee {
* public EmployeeStatus getStatus() {...}
* &#064;Enumerated(STRING)
* public SalaryRate getPayScale() {...}
* ...
* }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Enumerated {
/** (Optional) The type used in mapping an enum type. */
EnumType value() default ORDINAL;
}

View File

@ -1,65 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Defines strategies for fetching data from the database.
* The <code>EAGER</code> strategy is a requirement on the persistence
* provider runtime that data must be eagerly fetched. The
* <code>LAZY</code> strategy is a hint to the persistence provider
* runtime that data should be fetched lazily when it is
* first accessed. The implementation is permitted to eagerly
* fetch data for which the <code>LAZY</code> strategy hint has been
* specified. In particular, lazy fetching might only be
* available for {@link Basic} mappings for which property-based
* access is used.
*
* <pre>
* Example:
* &#064;Basic(fetch=LAZY)
* protected String getName() { return name; }
* </pre>
*
* @since Java Persistence 1.0
*/
public enum FetchType {
/** Defines that data can be lazily fetched */
LAZY,
/** Defines that data must be eagerly fetched */
EAGER
}

View File

@ -1,81 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to map the columns specified in the SELECT list
* of the query to the properties or fields of the entity class.
*
* <pre>
*
* Example:
* Query q = em.createNativeQuery(
* "SELECT o.id AS order_id, " +
* "o.quantity AS order_quantity, " +
* "o.item AS order_item, " +
* "FROM Order o, Item i " +
* "WHERE (order_quantity > 25) AND (order_item = i.id)",
* "OrderResults");
*
* &#064;SqlResultSetMapping(name="OrderResults",
* entities={
* &#064;EntityResult(entityClass=com.acme.Order.class, fields={
* &#064;FieldResult(name="id", column="order_id"),
* &#064;FieldResult(name="quantity", column="order_quantity"),
* &#064;FieldResult(name="item", column="order_item")})
* })
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({})
@Retention(RUNTIME)
public @interface FieldResult {
/** Name of the persistent field or property of the class. */
String name();
/**
* Name of the column in the SELECT clause - i.e., column
* aliases, if applicable.
*/
String column();
}

View File

@ -1,67 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Flush mode setting.
*
* <p> When queries are executed within a transaction, if
* <code>FlushModeType.AUTO</code> is set on the {@link Query}
* object, or if the flush mode setting for the persistence context
* is <code>AUTO</code> (the default) and a flush mode setting has
* not been specified for the {@link Query} object, the persistence
* provider is responsible for ensuring that all updates to the state
* of all entities in the persistence context which could potentially
* affect the result of the query are visible to the processing
* of the query. The persistence provider implementation may achieve
* this by flushing those entities to the database or by some other
* means. If <code>FlushModeType.COMMIT</code> is set, the effect
* of updates made to entities in the persistence context upon
* queries is unspecified.
*
* <p> If there is no transaction active, the persistence provider
* must not flush to the database.
*
* @since Java Persistence 1.0
*/
public enum FlushModeType {
/** Flushing must occur only at transaction commit */
COMMIT,
/** (Default) Flushing to occur at query execution */
AUTO
}

View File

@ -1,90 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.GenerationType.AUTO;
/**
* Provides for the specification of generation strategies for
* the values of primary keys. The <code>GeneratedValue</code>
* annotation may be applied to a primary key property or
* field of an entity or mapped superclass in conjunction with
* the {@link Id} annotation.
*
* <pre>
*
* Example 1:
*
* &#064;Id
* &#064;GeneratedValue(strategy=SEQUENCE, generator="CUST_SEQ")
* &#064;Column(name="CUST_ID")
* public Long getId() { return id; }
*
* Example 2:
*
* &#064;Id
* &#064;GeneratedValue(strategy=TABLE, generator="CUST_GEN")
* &#064;Column(name="CUST_ID")
* Long id;
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface GeneratedValue {
/**
* (Optional) The primary key generation strategy
* that the persistence provider must use to
* generate the annotated entity primary key.
*/
GenerationType strategy() default AUTO;
/**
* (Optional) The name of the primary key generator
* to use as specified in the {@link SequenceGenerator}
* or {@link TableGenerator} annotation.
* <p> Defaults to the id generator supplied by persistence provider.
*/
String generator() default "";
}

View File

@ -1,74 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Defines the types of primary key generation.
*
* @since Java Persistence 1.0
*/
public enum GenerationType {
/**
* Indicates that the persistence provider must assign
* primary keys for the entity using an underlying
* database table to ensure uniqueness.
*/
TABLE,
/**
* Indicates that the persistence provider must assign
* primary keys for the entity using database sequence column.
*/
SEQUENCE,
/**
* Indicates that the persistence provider must assign
* primary keys for the entity using database identity column.
*/
IDENTITY,
/**
* Indicates that the persistence provider should pick an
* appropriate strategy for the particular database. The
* <code>AUTO</code> generation strategy may expect a database
* resource to exist, or it may attempt to create one. A vendor
* may provide documentation on how to create such resources
* in the event that it does not support schema generation
* or cannot create the schema resource at runtime.
*/
AUTO
}

View File

@ -1,59 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Specifies the primary key property or field of an entity.
*
* <pre>
* Example:
*
* &#064;Id
* public Long getId() { return id; }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Id {}

View File

@ -1,73 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Specifies a composite primary key class that is mapped to
* multiple fields or properties of the entity.
*
* <p> The names of the fields or properties in the primary key
* class and the primary key fields or properties of the entity
* must correspond and their types must be the same.
*
* <pre>
*
* Example:
*
* &#064;IdClass(com.acme.EmployeePK.class)
* &#064;Entity
* public class Employee {
* &#064;Id String empName;
* &#064;Id Date birthDay;
* ...
* }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface IdClass {
/** Primary key class */
Class value();
}

View File

@ -1,70 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.InheritanceType.SINGLE_TABLE;
/**
* Defines the inheritance strategy to be used for an entity class
* hierarchy. It is specified on the entity class that is the root
* of the entity class hierarchy.
*
* <pre>
*
* Example:
*
* &#064;Entity
* &#064;Inheritance(strategy=JOINED)
* public class Customer { ... }
*
* &#064;Entity
* public class ValuedCustomer extends Customer { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface Inheritance {
/** The strategy to be used */
InheritanceType strategy() default SINGLE_TABLE;
}

View File

@ -1,58 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Defines inheritance strategy options.
*
* @since Java Persistence 1.0
*/
public enum InheritanceType {
/** A single table per class hierarchy */
SINGLE_TABLE,
/** A table per concrete entity class */
TABLE_PER_CLASS,
/**
* A strategy in which fields that are specific to a
* subclass are mapped to a separate table than the fields
* that are common to the parent class, and a join is
* performed to instantiate the subclass.
*/
JOINED
}

View File

@ -1,139 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to specify a mapped column for joining an entity association.
*
* <pre>
* Example:
*
* &#064;ManyToOne
* &#064;JoinColumn(name="ADDR_ID")
* public Address getAddress() { return address; }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface JoinColumn {
/**
* (Optional) The name of the foreign key column.
* The table in which it is found depends upon the
* context. If the join is for a OneToOne or Many-
* ToOne mapping, the foreign key column is in the
* table of the source entity. If the join is for a
* ManyToMany, the foreign key is in a join table.
*
* Default (only applies if a single join column is used):
* The concatenation of the following: the name of the
* referencing relationship property or field of the referencing
* entity; "_"; the name of the referenced primary key column.
* If there is no such referencing relationship property or
* field in the entity, the join column name is formed as the
* concatenation of the following: the name of the entity; "_";
* the name of the referenced primary key column.
*/
String name() default "";
/**
* (Optional) The name of the column referenced
* by this foreign key column. When used with
* relationship mappings, the referenced column is
* in the table of the target entity. When used inside
* a JoinTable annotation, the referenced key column
* is in the entity table of the owning entity, or
* inverse entity if the join is part of the inverse join
* definition.
*
* Default (only applies if single join column is being
* used): The same name as the primary key column of the
* referenced table.
*/
String referencedColumnName() default "";
/**
* (Optional) Whether the property is a unique key.
* This is a shortcut for the UniqueConstraint annotation
* at the table level and is useful for when the
* unique key constraint is only a single field. It is
* not necessary to explicitly specify this for a join
* column that corresponds to a primary key that is
* part of a foreign key.
*/
boolean unique() default false;
/** (Optional) Whether the foreign key column is nullable. */
boolean nullable() default true;
/**
* (Optional) Whether the column is included in
* SQL INSERT statements generated by the persistence
* provider.
*/
boolean insertable() default true;
/**
* (Optional) Whether the column is included in
* SQL UPDATE statements generated by the persistence
* provider.
*/
boolean updatable() default true;
/**
* (Optional) The SQL fragment that is used when
* generating the DDL for the column.
* <p> Defaults to the generated SQL for the column.
*/
String columnDefinition() default "";
/**
* (Optional) The name of the table that contains
* the column. If a table is not specified, the column
* is assumed to be in the primary table of the
* applicable entity.
*/
String table() default "";
}

View File

@ -1,71 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Defines mapping for the composite foreign keys. This annotation
* groups {@link JoinColumn} annotations for the same relationship.
*
* <p> When the <code>JoinColumns</code> annotation is used,
* both the {@link JoinColumn#name name} and the {@link
* JoinColumn#referencedColumnName referencedColumnName} elements
* must be specified in each such {@link JoinColumn} annotation.
*
* <pre>
*
* Example:
* &#064;ManyToOne
* &#064;JoinColumns({
* &#064;JoinColumn(name="ADDR_ID", referencedColumnName="ID"),
* &#064;JoinColumn(name="ADDR_ZIP", referencedColumnName="ZIP")
* })
* public Address getAddress() { return address; }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface JoinColumns {
JoinColumn[] value();
}

View File

@ -1,122 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation is used in the mapping of associations. It
* is specified on the owning side of a many-to-many association,
* or in a unidirectional one-to-many association.
*
* <p> If the <code>JoinTable</code> annotation is missing, the
* default values of the annotation elements apply. The name
* of the join table is assumed to be the table names of the
* associated primary tables concatenated together (owning side
* first) using an underscore.
*
* <pre>
*
* Example:
* &#064;JoinTable(
* name="CUST_PHONE",
* joinColumns=
* &#064;JoinColumn(name="CUST_ID", referencedColumnName="ID"),
* inverseJoinColumns=
* &#064;JoinColumn(name="PHONE_ID", referencedColumnName="ID")
* )
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface JoinTable {
/**
* (Optional) The name of the join table.
*
* <p> Defaults to the concatenated names of
* the two associated primary entity tables,
* separated by an underscore.
*/
String name() default "";
/** (Optional) The catalog of the table.
* <p> Defaults to the default catalog.
*/
String catalog() default "";
/** (Optional) The schema of the table.
* <p> Defaults to the default schema for user.
*/
String schema() default "";
/**
* (Optional) The foreign key columns
* of the join table which reference the
* primary table of the entity owning the
* association (i.e. the owning side of
* the association).
*
* <p> Uses the same defaults as for {@link JoinColumn}.
*/
JoinColumn[] joinColumns() default {};
/**
* (Optional) The foreign key columns
* of the join table which reference the
* primary table of the entity that does
* not own the association (i.e. the
* inverse side of the association).
*
* <p> Uses the same defaults as for {@link JoinColumn}.
*/
JoinColumn[] inverseJoinColumns() default {};
/**
* (Optional) Unique constraints that are
* to be placed on the table. These are
* only used if table generation is in effect.
* <p> Defaults to no additional constraints.
*/
UniqueConstraint[] uniqueConstraints() default {};
}

View File

@ -1,68 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Specifies that a persistent property or field should be persisted
* as a large object to a database-supported large object type.
* The <code>Lob</code> annotation may be used in conjunction
* with the {@link Basic} annotation. A <code>Lob</code> may be
* either a binary or character type.
*
* <p> The <code>Lob</code> type is inferred from the type of the
* persistent field or property, and except for string and
* character-based types defaults to Blob.
* <pre>
*
* Example:
*
* &#064;Lob &#064;Basic(fetch=LAZY)
* &#064;Column(name="REPORT")
* protected String report;
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Lob {
}

View File

@ -1,86 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Lock modes that can be specified by means of the
* {@link EntityManager#lock EntityManager.lock()} method.
*
* <p> The semantics of requesting locks of type
* {@link LockModeType#READ LockModeType.READ} and {@link
* LockModeType#WRITE LockModeType.WRITE} are the following.
*
* <p> If transaction T1 calls lock(entity, {@link
* LockModeType#READ LockModeType.READ}) on a versioned object,
* the entity manager must ensure that neither of the following
* phenomena can occur:
* <ul>
* <li> P1 (Dirty read): Transaction T1 modifies a row.
* Another transaction T2 then reads that row and obtains
* the modified value, before T1 has committed or rolled back.
* Transaction T2 eventually commits successfully; it does not
* matter whether T1 commits or rolls back and whether it does
* so before or after T2 commits.
* <li>
* </li> P2 (Non-repeatable read): Transaction T1 reads a row.
* Another transaction T2 then modifies or deletes that row,
* before T1 has committed. Both transactions eventually commit
* successfully.
* </li>
* </ul>
*
* <p> Lock modes must always prevent the phenomena P1 and P2.
*
* <p> In addition, calling lock(entity, LockModeType.WRITE) on
* a versioned object, will also force an update (increment) to
* the entity's version column.
*
* <p> The persistence implementation is not required to support
* calling {@link EntityManager#lock EntityManager.lock()} on a
* non-versioned object. When it cannot support a such lock call,
* it must throw the {@link PersistenceException}.
*
*
* @since Java Persistence 1.0
*/
public enum LockModeType {
/** Read lock */
READ,
/** Write lock */
WRITE
}

View File

@ -1,146 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import javax.persistence.CascadeType;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.FetchType.LAZY;
/**
* Defines a many-valued association with many-to-many multiplicity.
* If the Collection is defined using generics to specify the element
* type, the associated target entity class does not need to be
* specified; otherwise it must be specified.
*
* <p> Every many-to-many association has two sides, the owning
* side and the non-owning, or inverse, side. The join table is
* specified on the owning side. If the association is bidirectional,
* either side may be designated as the owning side.
*
* <p> The same annotation elements for the {@link OneToMany}
* annotation apply to the <code>ManyToMany</code> annotation.
*
* <pre>
*
* Example 1:
*
* In Customer class:
*
* &#064;ManyToMany
* &#064;JoinTable(name="CUST_PHONES")
* public Set<PhoneNumber> getPhones() { return phones; }
*
* In PhoneNumber class:
*
* &#064;ManyToMany(mappedBy="phones")
* public Set<Customer> getCustomers() { return customers; }
*
* Example 2:
*
* In Customer class:
*
* &#064;ManyToMany(targetEntity=com.acme.PhoneNumber.class)
* public Set getPhones() { return phones; }
*
* In PhoneNumber class:
*
* &#064;ManyToMany(targetEntity=com.acme.Customer.class, mappedBy="phones")
* public Set getCustomers() { return customers; }
*
* Example 3:
*
* In Customer class:
*
* &#064;ManyToMany
* &#064;JoinTable(name="CUST_PHONE",
* joinColumns=
* &#064;JoinColumn(name="CUST_ID", referencedColumnName="ID"),
* inverseJoinColumns=
* &#064;JoinColumn(name="PHONE_ID", referencedColumnName="ID")
* )
* public Set<PhoneNumber> getPhones() { return phones; }
*
* In PhoneNumberClass:
*
* &#064;ManyToMany(mappedBy="phones")
* public Set<Customer> getCustomers() { return customers; }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface ManyToMany {
/**
* (Optional) The entity class that is the target
* of the association. Optional only if the collection
* property is defined using Java generics.
* Must be specified otherwise.
*
* <p> Defaults to the parameterized type of
* the collection when defined using generics.
*/
Class targetEntity() default void.class;
/**
* (Optional) The operations that must be cascaded to
* the target of the association.
* <p> Defaults to no operations being cascaded.
*/
CascadeType[] cascade() default {};
/** (Optional) Whether the association should be
* lazily loaded or must be eagerly fetched. The
* {@link FetchType#EAGER EAGER} strategy is a
* requirement on the persistenceprovider runtime
* that the associatedentities must be eagerly fetched.
* The {@link FetchType#LAZY LAZY} strategy is a hint
* to the persistence provider runtime.
*/
FetchType fetch() default LAZY;
/**
* The field that owns the relationship. Required unless
* the relationship is unidirectional.
*/
String mappedBy() default "";
}

View File

@ -1,99 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import javax.persistence.CascadeType;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.FetchType.EAGER;
/**
* This annotation defines a single-valued association to another
* entity class that has many-to-one multiplicity. It is not normally
* necessary to specify the target entity explicitly since it can
* usually be inferred from the type of the object being referenced.
*
* <pre>
*
* Example:
*
* &#064;ManyToOne(optional=false)
* &#064;JoinColumn(name="CUST_ID", nullable=false, updatable=false)
* public Customer getCustomer() { return customer; }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface ManyToOne {
/**
* (Optional) The entity class that is the target of
* the association.
*
* <p> Defaults to the type of the field or property
* that stores the association.
*/
Class targetEntity() default void.class;
/**
* (Optional) The operations that must be cascaded to
* the target of the association.
*
* <p> By default no operations are cascaded.
*/
CascadeType[] cascade() default {};
/**
* (Optional) Whether the association should be lazily
* loaded or must be eagerly fetched. The {@link FetchType#EAGER EAGER}
* strategy is a requirement on the persistence provider runtime that
* the associated entity must be eagerly fetched. The {@link FetchType#LAZY
* LAZY} strategy is a hint to the persistence provider runtime.
*/
FetchType fetch() default EAGER;
/**
* (Optional) Whether the association is optional. If set
* to false then a non-null relationship must always exist.
*/
boolean optional() default true;
}

View File

@ -1,120 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to specify the map key for associations of type
* {@link java.util.Map}.
*
* <p> If a persistent field or property other than the primary
* key is used as a map key then it is expected to have a
* uniqueness constraint associated with it.
*
* <pre>
*
* Example 1:
*
* &#064;Entity
* public class Department {
* ...
* &#064;OneToMany(mappedBy="department")
* &#064;MapKey(name="empId")
* public Map<Integer, Employee> getEmployees() {... }
* ...
* }
*
* &#064;Entity
* public class Employee {
* ...
* &#064;Id Integer getEmpid() { ... }
* &#064;ManyToOne
* &#064;JoinColumn(name="dept_id")
* public Department getDepartment() { ... }
* ...
* }
*
* Example 2:
*
* &#064;Entity
* public class Department {
* ...
* &#064;OneToMany(mappedBy="department")
* &#064;MapKey(name="empPK")
* public Map<EmployeePK, Employee> getEmployees() {... }
* ...
* }
*
* &#064;Entity
* public class Employee {
* &#064;EmbeddedId public EmployeePK getEmpPK() { ... }
* ...
* &#064;ManyToOne
* &#064;JoinColumn(name="dept_id")
* public Department getDepartment() { ... }
* ...
* }
*
* &#064;Embeddable
* public class EmployeePK {
* String name;
* Date bday;
* }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface MapKey {
/**
* The name of the persistent field or property of the
* associated entity that is used as the map key. If the
* name element is not specified, the primary key of the
* associated entity is used as the map key. If the
* primary key is a composite primary key and is mapped
* as {@link IdClass}, an instance of the primary key
* class is used as the key.
*/
String name() default "";
}

View File

@ -1,152 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Designates a class whose mapping information is applied
* to the entities that inherit from it. A mapped superclass
* has no separate table defined for it.
*
* <p> A class designated with the <code>MappedSuperclass</code>
* annotation can be mapped in the same way as an entity except that the
* mappings will apply only to its subclasses since no table
* exists for the mapped superclass itself. When applied to the
* subclasses the inherited mappings will apply in the context
* of the subclass tables. Mapping information may be overridden
* in such subclasses by using the {@link AttributeOverride} and
* {@link AssociationOverride} annotations or corresponding XML elements.
*
* <pre>
* Example: Concrete class as a mapped superclass
*
* &#064;MappedSuperclass
* public class Employee {
*
* &#064;Id protected Integer empId;
* &#064;Version protected Integer version;
* &#064;ManyToOne &#064;JoinColumn(name="ADDR")
* protected Address address;
*
* public Integer getEmpId() { ... }
* public void setEmpId(Integer id) { ... }
* public Address getAddress() { ... }
* public void setAddress(Address addr) { ... }
* }
*
* // Default table is FTEMPLOYEE table
* &#064;Entity
* public class FTEmployee extends Employee {
*
* // Inherited empId field mapped to FTEMPLOYEE.EMPID
* // Inherited version field mapped to FTEMPLOYEE.VERSION
* // Inherited address field mapped to FTEMPLOYEE.ADDR fk
*
*
* // Defaults to FTEMPLOYEE.SALARY
*
* protected Integer salary;
*
*
* public FTEmployee() {}
*
*
* public Integer getSalary() { ... }
*
* public void setSalary(Integer salary) { ... }
* }
*
* &#064;Entity &#064;Table(name="PT_EMP")
* &#064;AssociationOverride(name="address",
*
*
* joincolumns=&#064;JoinColumn(name="ADDR_ID"))
* public class PartTimeEmployee extends Employee {
*
* // Inherited empId field mapped to PT_EMP.EMPID
* // Inherited version field mapped to PT_EMP.VERSION
* // address field mapping overridden to PT_EMP.ADDR_ID fk
* &#064;Column(name="WAGE")
* protected Float hourlyWage;
*
* public PartTimeEmployee() {}
*
* public Float getHourlyWage() { ... }
* public void setHourlyWage(Float wage) { ... }
* }
*
* Example: Non-entity superclass
*
* public class Cart {
*
* // This state is transient
* Integer operationCount;
*
* public Cart() { operationCount = 0; }
* public Integer getOperationCount() { return operationCount; }
* public void incrementOperationCount() { operationCount++; }
* }
*
* &#064Entity
* public class ShoppingCart extends Cart {
*
* Collection<Item> items = new Vector<Item>();
*
* public ShoppingCart() { super(); }
*
*
* ...
*
* &#064OneToMany
* public Collection<Item> getItems() { return items; }
* public void addItem(Item item) {
* items.add(item);
* incrementOperationCount();
* }
* }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface MappedSuperclass {
}

View File

@ -1,123 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import javax.persistence.CascadeType;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.FetchType.LAZY;
/**
* Defines a many-valued association with one-to-many multiplicity.
*
* <p> If the collection is defined using generics to specify the
* element type, the associated target entity type need not be
* specified; otherwise the target entity class must be specified.
*
* <pre>
*
* Example 1: One-to-Many association using generics
*
* In Customer class:
*
* &#064;OneToMany(cascade=ALL, mappedBy="customer")
* public Set<Order> getOrders() { return orders; }
*
* In Order class:
*
* &#064;ManyToOne
* &#064;JoinColumn(name="CUST_ID", nullable=false)
* public Customer getCustomer() { return customer; }
*
* Example 2: One-to-Many association without using generics
*
* In Customer class:
*
* &#064;OneToMany(targetEntity=com.acme.Order.class, cascade=ALL,
* mappedBy="customer")
* public Set getOrders() { return orders; }
*
* In Order class:
*
* &#064;ManyToOne
* &#064;JoinColumn(name="CUST_ID", nullable=false)
* public Customer getCustomer() { return customer; }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface OneToMany {
/**
* (Optional) The entity class that is the target
* of the association. Optional only if the collection
* property is defined using Java generics.
* Must be specified otherwise.
*
* <p> Defaults to the parameterized type of
* the collection when defined using generics.
*/
Class targetEntity() default void.class;
/**
* (Optional) The operations that must be cascaded to
* the target of the association.
* <p> Defaults to no operations being cascaded.
*/
CascadeType[] cascade() default {};
/** (Optional) Whether the association should be
* lazily loaded or must be eagerly fetched. The
* {@link FetchType#EAGER EAGER} strategy is a
* requirement on the persistenceprovider runtime
* that the associatedentities must be eagerly fetched.
* The {@link FetchType#LAZY LAZY} strategy is a hint
* to the persistence provider runtime.
*/
FetchType fetch() default LAZY;
/**
* The field that owns the relationship. Required unless
* the relationship is unidirectional.
*/
String mappedBy() default "";
}

View File

@ -1,134 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import javax.persistence.CascadeType;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.FetchType.EAGER;
/**
* This annotation defines a single-valued association to
* another entity that has one-to-one multiplicity. It is not
* normally necessary to specify the associated target entity
* explicitly since it can usually be inferred from the type
* of the object being referenced.
*
* <pre>
* Example 1: One-to-one association that maps a foreign key column
*
* On Customer class:
*
* &#064;OneToOne(optional=false)
* &#064;JoinColumn(
* name="CUSTREC_ID", unique=true, nullable=false, updatable=false)
* public CustomerRecord getCustomerRecord() { return customerRecord; }
*
* On CustomerRecord class:
*
* &#064;OneToOne(optional=false, mappedBy="customerRecord")
* public Customer getCustomer() { return customer; }
*
* Example 2: One-to-one association that assumes both the source and target share the same primary key values.
*
* On Employee class:
*
* &#064;Entity
* public class Employee {
* &#064;Id Integer id;
*
* &#064;OneToOne &#064;PrimaryKeyJoinColumn
* EmployeeInfo info;
* ...
* }
*
* On EmployeeInfo class:
*
* &#064;Entity
* public class EmployeeInfo {
* &#064;Id Integer id;
* ...
* }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface OneToOne {
/**
* (Optional) The entity class that is the target of
* the association.
*
* <p> Defaults to the type of the field or property
* that stores the association.
*/
Class targetEntity() default void.class;
/**
* (Optional) The operations that must be cascaded to
* the target of the association.
*
* <p> By default no operations are cascaded.
*/
CascadeType[] cascade() default {};
/**
* (Optional) Whether the association should be lazily
* loaded or must be eagerly fetched. The {@link FetchType#EAGER EAGER}
* strategy is a requirement on the persistence provider runtime that
* the associated entity must be eagerly fetched. The {@link FetchType#LAZY
* LAZY} strategy is a hint to the persistence provider runtime.
*/
FetchType fetch() default EAGER;
/**
* (Optional) Whether the association is optional. If set
* to false then a non-null relationship must always exist.
*/
boolean optional() default true;
/** (Optional) The field that owns the relationship. This
* element is only specified on the inverse (non-owning)
* side of the association.
*/
String mappedBy() default "";
}

View File

@ -1,110 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation specifies the ordering of the elements of a
* collection valued association at the point when the association
* is retrieved.
*
* <p> The syntax of the <code>value</code> ordering element is an
* <code>orderby_list</code>, as follows:
*
* <pre>
* orderby_list::= orderby_item [,orderby_item]*
* orderby_item::= property_or_field_name [ASC | DESC]
* </pre>
*
* <p> If <code>ASC</code> or <code>DESC</code> is not specified,
* <code>ASC</code> (ascending order) is assumed.
*
* <p> If the ordering element is not specified, ordering by
* the primary key of the associated entity is assumed.
*
* <p> The property or field name must correspond to that of a
* persistent property or field of the associated class. The
* properties or fields used in the ordering must correspond to
* columns for which comparison operators are supported.
*
* <pre>
* Example:
*
* &#064;Entity public class Course {
* ...
* &#064;ManyToMany
* &#064;OrderBy("lastname ASC")
* public List<Student> getStudents() {...};
* ...
* }
*
* &#064;Entity public class Student {
* ...
* &#064;ManyToMany(mappedBy="students")
* &#064;OrderBy // PK is assumed
* public List<Course> getCourses() {...};
* ...
* }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface OrderBy {
/**
* An <code>orderby_list</code>, specified as follows:
*
* <pre>
* orderby_list::= orderby_item [,orderby_item]*
* orderby_item::= property_or_field_name [ASC | DESC]
* </pre>
*
* <p> If <code>ASC</code> or <code>DESC</code> is not specified,
* <code>ASC</code> (ascending order) is assumed.
*
* <p> If the ordering element is not specified, ordering by
* the primary key of the associated entity is assumed.
*/
String value() default "";
}

View File

@ -1,86 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Thrown by the persistence provider when a problem occurs.
* All instances of <code>PersistenceException</code> except for instances of
* {@link NoResultException} and {@link NonUniqueResultException} will cause
* the current transaction, if one is active, to be marked for rollback.
*
* @since Java Persistence 1.0
*/
@SuppressWarnings("serial")
public class PersistenceException extends RuntimeException {
/**
* Constructs a new <code>PersistenceException</code> exception
* with <code>null</code> as its detail message.
*/
public PersistenceException() {
super();
}
/**
* Constructs a new <code>PersistenceException</code> exception
* with the specified detail message.
* @param message the detail message.
*/
public PersistenceException(String message) {
super(message);
}
/**
* Constructs a new <code>PersistenceException</code> exception
* with the specified detail message and cause.
* @param message the detail message.
* @param cause the cause.
*/
public PersistenceException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new <code>PersistenceException</code> exception
* with the specified cause.
* @param cause the cause.
*/
public PersistenceException(Throwable cause) {
super(cause);
}
};

View File

@ -1,54 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to specify callback methods for the corresponding
* lifecycle event. This annotation may be applied to methods
* of an entity class, a mapped superclass, or a callback
* listener class.
*
* @since Java Persistence 1.0
*/
@Target({METHOD})
@Retention(RUNTIME)
public @interface PostLoad {}

View File

@ -1,54 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to specify callback methods for the corresponding
* lifecycle event. This annotation may be applied to methods
* of an entity class, a mapped superclass, or a callback
* listener class.
*
* @since Java Persistence 1.0
*/
@Target({METHOD})
@Retention(RUNTIME)
public @interface PostPersist {}

View File

@ -1,54 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to specify callback methods for the corresponding
* lifecycle event. This annotation may be applied to methods
* of an entity class, a mapped superclass, or a callback
* listener class.
*
* @since Java Persistence 1.0
*/
@Target({METHOD})
@Retention(RUNTIME)
public @interface PostRemove {}

View File

@ -1,54 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to specify callback methods for the corresponding
* lifecycle event. This annotation may be applied to methods
* of an entity class, a mapped superclass, or a callback
* listener class.
*
* @since Java Persistence 1.0
*/
@Target({METHOD})
@Retention(RUNTIME)
public @interface PostUpdate {}

View File

@ -1,120 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation specifies a primary key column that is used
* as a foreign key to join to another table.
*
* <p> It is used to join the primary table of an entity subclass
* in the {@link InheritanceType#JOINED JOINED} mapping strategy
* to the primary table of its superclass; it is used within a
* {@link SecondaryTable} annotation to join a secondary table
* to a primary table; and it may be used in a {@link OneToOne}
* mapping in which the primary key of the referencing entity
* is used as a foreign key to the referenced entity.
*
* <p> If no <code>PrimaryKeyJoinColumn</code> annotation is
* specified for a subclass in the {@link InheritanceType#JOINED
* JOINED} mapping strategy, the foreign key columns are assumed
* to have the same names as the primary key columns of the
* primary table of the superclass
*
* <pre>
*
* Example: Customer and ValuedCustomer subclass
*
* &#064;Entity
* &#064;Table(name="CUST")
* &#064;Inheritance(strategy=JOINED)
* &#064;DiscriminatorValue("CUST")
* public class Customer { ... }
*
* &#064;Entity
* &#064;Table(name="VCUST")
* &#064;DiscriminatorValue("VCUST")
* &#064;PrimaryKeyJoinColumn(name="CUST_ID")
* public class ValuedCustomer extends Customer { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface PrimaryKeyJoinColumn {
/**
* The name of the primary key column of the current table.
* <p> Defaults to the same name as the primary key column
* of the primary table of the superclass ({@link
* InheritanceType#JOINED JOINED} mapping strategy); the same
* name as the primary key column of the primary table
* ({@link SecondaryTable} mapping); or the same name as the
* primary key column for the table for the referencing entity
* ({@link OneToOne} mapping)
*/
String name() default "";
/**
* (Optional) The name of the primary key column of the table
* being joined to.
* <p> Defaults to the same name as the primary key column
* of the primary table of the superclass ({@link
* InheritanceType#JOINED JOINED} mapping strategy); the same
* name as the primary key column of the primary table
* ({@link SecondaryTable} mapping); or the same name as the
* primary key column for the table for the referencing entity
* ({@link OneToOne} mapping)
*/
String referencedColumnName() default "";
/**
* (Optional) The SQL fragment that is used when generating the
* DDL for the column. This should not be specified for a
* {@link OneToOne} primary key association.
* <p> Defaults to the generated SQL to create a column of the
* inferred type.
*/
String columnDefinition() default "";
}

View File

@ -1,73 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation groups {@link PrimaryKeyJoinColumn} annotations.
* It is used to map composite foreign keys.
*
* <pre>
* Example 1: ValuedCustomer subclass
*
* &#064;Entity
* &#064;Table(name="VCUST")
* &#064;DiscriminatorValue("VCUST")
* &#064;PrimaryKeyJoinColumns({
* &#064;PrimaryKeyJoinColumn(name="CUST_ID",
* referencedColumnName="ID"),
* &#064;PrimaryKeyJoinColumn(name="CUST_TYPE",
* referencedColumnName="TYPE")
* })
* public class ValuedCustomer extends Customer { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface PrimaryKeyJoinColumns {
/** One or more {@link PrimaryKeyJoinColumn} annotations. */
PrimaryKeyJoinColumn[] value();
}

View File

@ -1,120 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation is used to specify a secondary table for
* the annotated entity class. Specifying one or more secondary
* tables indicates that the data for the entity class is stored
* across multiple tables.
*
* <p> If no <code>SecondaryTable</code> annotation is specified,
* it is assumed that all persistent fields or properties of the
* entity are mapped to the primary table. If no primary key join
* columns are specified, the join columns are assumed to reference
* the primary key columns of the primary table, and have the same
* names and types as the referenced primary key columns of the
* primary table.
*
* <pre>
* Example 1: Single secondary table with a single primary key column.
*
* &#064;Entity
* &#064;Table(name="CUSTOMER")
* &#064;SecondaryTable(name="CUST_DETAIL",
* pkJoinColumns=&#064;PrimaryKeyJoinColumn(name="CUST_ID"))
* public class Customer { ... }
*
* Example 2: Single secondary table with multiple primary key columns.
*
* &#064;Entity
* &#064;Table(name="CUSTOMER")
* &#064;SecondaryTable(name="CUST_DETAIL",
* pkJoinColumns={
* &#064;PrimaryKeyJoinColumn(name="CUST_ID"),
* &#064;PrimaryKeyJoinColumn(name="CUST_TYPE")})
* public class Customer { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target(TYPE)
@Retention(RUNTIME)
public @interface SecondaryTable {
/** (Required) The name of the table. */
String name();
/** (Optional) The catalog of the table.
* <p> Defaults to the default catalog.
*/
String catalog() default "";
/** (Optional) The schema of the table.
* <p> Defaults to the default schema for user.
*/
String schema() default "";
/**
* (Optional) The columns that are used to join with
* the primary table.
* <p> Defaults to the column(s) of the same name(s)
* as the primary key column(s) in the primary table
*/
PrimaryKeyJoinColumn[] pkJoinColumns() default {};
/**
* (Optional) Unique constraints that are to be placed on the
* table. These are typically only used if table generation
* is in effect. These constraints apply in addition to any
* constraints specified by the {@link Column} and {@link JoinColumn}
* annotations and constraints entailed by primary key mappings.
* <p> Defaults to no additional constraints.
*/
UniqueConstraint[] uniqueConstraints() default {};
/**
* (Optional) join type (supports inner, left, right) to use
* for querying data from the joined tables.
*/
String join() default "";
}

View File

@ -1,80 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation is used to specify multiple secondary tables
* for an entity.
*
* <pre>
* Example 1: Multiple secondary tables assuming primary key columns are named the same in all tables.
*
* &#064;Entity
* &#064;Table(name="EMPLOYEE")
* &#064;SecondaryTables({
* &#064;SecondaryTable(name="EMP_DETAIL"),
* &#064;SecondaryTable(name="EMP_HIST")
* })
* public class Employee { ... }
*
* Example 2: Multiple secondary tables with differently named primary key columns.
*
* &#064;Entity
* &#064;Table(name="EMPLOYEE")
* &#064;SecondaryTables({
* &#064;SecondaryTable(name="EMP_DETAIL",
* pkJoinColumns=&#064;PrimaryKeyJoinColumn(name="EMPL_ID")),
* &#064;SecondaryTable(name="EMP_HIST",
* pkJoinColumns=&#064;PrimaryKeyJoinColumn(name="EMPLOYEE_ID"))
* })
* public class Employee { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target(TYPE)
@Retention(RUNTIME)
public @interface SecondaryTables {
/** The secondary tables for an entity. */
SecondaryTable[] value();
}

View File

@ -1,91 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation defines a primary key generator that may
* be referenced by name when a generator element is specified
* for the {@link GeneratedValue} annotation. A sequence generator
* may be specified on the entity class or on the primary key
* field or property. The scope of the generator name is global
* to the persistence unit (across all generator types).
*
* <pre>
* Example:
*
* &#064;SequenceGenerator(name="EMP_SEQ", allocationSize=25)
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface SequenceGenerator {
/**
* (Required) A unique generator name that can be referenced
* by one or more classes to be the generator for primary key
* values.
*/
String name();
/**
* (Optional) The name of the database sequence object from
* which to obtain primary key values.
* <p> Defaults to a provider-chosen value.
*/
String sequenceName() default "";
/**
* (Optional) The value from which the sequence object
* is to start generating.
*/
int initialValue() default 1;
/**
* (Optional) The amount to increment by when allocating
* sequence numbers from the sequence.
*/
int allocationSize() default 50;
}

View File

@ -1,87 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation is used to specify the mapping of the result
* of a native SQL query.
*
* <pre>
* Example:
*
* Query q = em.createNativeQuery(
* "SELECT o.id AS order_id, " +
* "o.quantity AS order_quantity, " +
* "o.item AS order_item, " +
* "i.name AS item_name, " +
* "FROM Order o, Item i " +
* "WHERE (order_quantity > 25) AND (order_item = i.id)",
* "OrderResults");
*
* &#064;SqlResultSetMapping(name="OrderResults",
* entities={
* &#064;EntityResult(entityClass=com.acme.Order.class, fields={
* &#064;FieldResult(name="id", column="order_id"),
* &#064;FieldResult(name="quantity", column="order_quantity"),
* &#064;FieldResult(name="item", column="order_item")})},
* columns={
* &#064;ColumnResult(name="item_name")}
* )
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface SqlResultSetMapping {
/**
* The name given to the result set mapping, and used to refer
* to it in the methods of the {@link Query} API.
*/
String name();
/** Specifies the result set mapping to entities. */
EntityResult[] entities() default {};
/** Specifies the result set mapping to scalar values. */
ColumnResult[] columns() default {};
}

View File

@ -1,54 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation is used to define one or more {@link SqlResultSetMapping}.
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface SqlResultSetMappings {
/** One or more {@link SqlResultSetMapping}. */
SqlResultSetMapping[] value();
}

View File

@ -1,91 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation specifies the primary table for the annotated
* entity. Additional tables may be specified using {@link SecondaryTable}
* or {@link SecondaryTables} annotation.
*
* <p> If no <code>Table</code> annotation is specified for an entity
* class, the default values apply.
*
* <pre>
* Example:
*
* &#064;Entity
* &#064;Table(name="CUST", schema="RECORDS")
* public class Customer { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target(TYPE)
@Retention(RUNTIME)
public @interface Table {
/**
* (Optional) The name of the table.
* <p> Defaults to the entity name.
*/
String name() default "";
/** (Optional) The catalog of the table.
* <p> Defaults to the default catalog.
*/
String catalog() default "";
/** (Optional) The schema of the table.
* <p> Defaults to the default schema for user.
*/
String schema() default "";
/**
* (Optional) Unique constraints that are to be placed on
* the table. These are only used if table generation is in
* effect. These constraints apply in addition to any constraints
* specified by the {@link Column} and {@link JoinColumn}
* annotations and constraints entailed by primary key mappings.
* <p> Defaults to no additional constraints.
*/
UniqueConstraint[] uniqueConstraints() default {};
}

View File

@ -1,157 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation defines a primary key generator that may be
* referenced by name when a generator element is specified for
* the {@link GeneratedValue} annotation. A table generator
* may be specified on the entity class or on the primary key
* field or property. The scope of the generator name is global
* to the persistence unit (across all generator types).
*
* <pre>
* Example 1:
*
* &#064;Entity public class Employee {
* ...
* &#064;TableGenerator(
* name="empGen",
* table="ID_GEN",
* pkColumnName="GEN_KEY",
* valueColumnName="GEN_VALUE",
* pkColumnValue="EMP_ID",
* allocationSize=1)
* &#064;Id
* &#064;GeneratedValue(strategy=TABLE, generator="empGen")
* public int id;
* ...
* }
*
* Example 2:
*
* &#064;Entity public class Address {
* ...
* &#064;TableGenerator(
* name="addressGen",
* table="ID_GEN",
* pkColumnName="GEN_KEY",
* valueColumnName="GEN_VALUE",
* pkColumnValue="ADDR_ID")
* &#064;Id
* &#064;GeneratedValue(strategy=TABLE, generator="addressGen")
* public int id;
* ...
* }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface TableGenerator {
/**
* (Required) A unique generator name that can be referenced
* by one or more classes to be the generator for id values.
*/
String name();
/**
* (Optional) Name of table that stores the generated id values.
* <p> Defaults to a name chosen by persistence provider.
*/
String table() default "";
/** (Optional) The catalog of the table.
* <p> Defaults to the default catalog.
*/
String catalog() default "";
/** (Optional) The schema of the table.
* <p> Defaults to the default schema for user.
*/
String schema() default "";
/**
* (Optional) Name of the primary key column in the table.
* <p> Defaults to a provider-chosen name.
*/
String pkColumnName() default "";
/**
* (Optional) Name of the column that stores the last value generated.
* <p> Defaults to a provider-chosen name.
*/
String valueColumnName() default "";
/**
* (Optional) The primary key value in the generator table
* that distinguishes this set of generated values from others
* that may be stored in the table.
* <p> Defaults to a provider-chosen value to store in the
* primary key column of the generator table
*/
String pkColumnValue() default "";
/**
* (Optional) The initial value to be used when allocating id
* numbers from the generator.
*/
int initialValue() default 0;
/**
* (Optional) The amount to increment by when allocating id
* numbers from the generator.
*/
int allocationSize() default 50;
/**
* (Optional) Unique constraints that are to be placed on the
* table. These are only used if table generation is in effect.
* These constraints apply in addition to primary key constraints.
* <p> Defaults to no additional constraints.
*/
UniqueConstraint[] uniqueConstraints() default {};
}

View File

@ -1,69 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.persistence.TemporalType.TIMESTAMP;
/**
* This annotation must be specified for persistent fields
* or properties of type {@link java.util.Date} and {@link
* java.util.Calendar}. It may only be specified for fields
* or properties of these types.
*
* <p> The <code>Temporal</code> annotation may be used in
* conjunction with the {@link Basic} annotation.
*
* <pre>
* Example:
*
* &#064;Temporal(DATE)
* protected java.util.Date endDate;
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Temporal {
/** The type used in mapping java.util.Date or java.util.Calendar. */
TemporalType value();
}

View File

@ -1,54 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
/**
* Type used to indicate a specific mapping of {@link java.util.Date}
* or {@link java.util.Calendar}.
*
* @since Java Persistence 1.0
*/
public enum TemporalType {
/** Map as java.sql.Date */
DATE,
/** Map as java.sql.Time */
TIME,
/** Map as java.sql.Timestamp */
TIMESTAMP
}

View File

@ -1,64 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation specifies that the property or field is
* not persistent. It is used to annotate a property or field
* of an entity class, mapped superclass, or embeddable class.
*
* <pre>
* Example:
* &#064;Entity
* public class Employee {
* &#064;Id int id;
* &#064;Transient User currentUser;
* ...
* }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Transient {}

View File

@ -1,67 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation is used to specify that a unique constraint
* is to be included in the generated DDL for a primary or secondary table.
*
* <pre>
* Example:
* &#064;Entity
* &#064;Table(
* name="EMPLOYEE",
* uniqueConstraints=
* &#064;UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
* )
* public class Employee { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({})
@Retention(RUNTIME)
public @interface UniqueConstraint {
/** (Required) An array of the column names that make up the constraint. */
String[] columnNames();
}

View File

@ -1,77 +0,0 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* This annotation specifies the version field or property of
* an entity class that serves as its optimistic lock value.
* The version is used to ensure integrity when performing the
* merge operation and for optimistic concurrency control.
*
* <p> Only a single <code>Version</code> property or field
* should be used per class; applications that use more than one
* <code>Version</code> property or field will not be portable.
*
* <p> The <code>Version</code> property should be mapped to
* the primary table for the entity class; applications that
* map the <code>Version</code> property to a table other than
* the primary table will not be portable.
*
* <p> The following types are supported for version properties:
* <code>int</code>, {@link Integer}, <code>short</code>,
* {@link Short}, <code>long</code>, {@link Long},
* {@link java.sql.Timestamp Timestamp}.
*
* <pre>
* Example:
*
* &#064;Version
* &#064;Column(name="OPTLOCK")
* protected int getVersionNum() { return versionNum; }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Version {}

View File

@ -1,19 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<!--
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
This software is the proprietary information of Sun Microsystems, Inc.
Use is subject to license terms.
-->
</HEAD>
<BODY BGCOLOR="white">
The javax.persistence package contains the classes and interfaces that
define the contracts between a persistence provider and the managed
classes and the clients of the Java Persistence API.
</BODY>
</HTML>