/******************************************************************************* | |
* Copyright (c) 2005, 2009 SAP. All rights reserved. | |
* This program and the accompanying materials are made available under the | |
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 | |
* which accompanies this distribution. | |
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | |
* and the Eclipse Distribution License is available at | |
* http://www.eclipse.org/org/documents/edl-v10.php. | |
* | |
* Contributors: | |
* SAP - initial API and implementation | |
******************************************************************************/ | |
package org.eclipse.persistence.testing.models.wdf.jpa1.component; | |
import javax.persistence.CascadeType; | |
import javax.persistence.Column; | |
import javax.persistence.DiscriminatorColumn; | |
import javax.persistence.DiscriminatorType; | |
import javax.persistence.Entity; | |
import javax.persistence.Id; | |
import javax.persistence.IdClass; | |
import javax.persistence.Inheritance; | |
import javax.persistence.InheritanceType; | |
import javax.persistence.JoinColumn; | |
import javax.persistence.ManyToOne; | |
import javax.persistence.Table; | |
@Entity | |
@Table(name = "TMP_METRIC") | |
@IdClass(MetricPk.class) | |
@Inheritance(strategy = InheritanceType.SINGLE_TABLE) | |
@DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING, length = 30) | |
// TODO fix model for abstract superclass | |
public abstract class Metric { | |
private Component component; | |
private Long componentId; | |
private Long inspectionId; | |
private String name; | |
@Id | |
@Column(name = "NAME") | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
@Id | |
@Column(name = "COMPONENT_ID") | |
public Long getComponentId() { | |
return componentId; | |
} | |
public void setComponentId(Long componentId) { | |
this.componentId = componentId; | |
} | |
@Id | |
@Column(name = "INSPECTION_ID") | |
public Long getInspectionId() { | |
return inspectionId; | |
} | |
public void setInspectionId(Long inspectionId) { | |
this.inspectionId = inspectionId; | |
} | |
// @ManyToOne(cascade = {CascadeType.PERSIST}) | |
// @JoinColumn(name = "INSPECTION_ID", insertable = false, updatable = false) | |
// public Inspection getInspection() { | |
// return inspection; | |
// } | |
// | |
// public void setInspection(Inspection inspection) { | |
// this.inspection = inspection; | |
// } | |
@ManyToOne(cascade = { CascadeType.PERSIST }) | |
@JoinColumn(name = "COMPONENT_ID", insertable = false, updatable = false) | |
public Component getComponent() { | |
return component; | |
} | |
public void setComponent(Component component) { | |
this.component = component; | |
} | |
} |