by
0
6
1,963
1
Top 1% !
Popular
Famous
Tagged
Specified
OpenSource
Popularity: 11274th place

Published on:

LanguageJava
LicenseMIT_X11

Port class - Integration of java JPA and JAXB

This is a generic abstract Port class, managed by a Card class.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/43633/Port-class---Integration-of-java-JPA-and?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
package com.examples.jpa; import java.io.Serializable; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.DiscriminatorColumn; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.ManyToOne; import javax.persistence.Transient; import javax.persistence.Version; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlIDREF; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; @Entity @Inheritance(strategy = InheritanceType.JOINED) @XmlAccessorType(XmlAccessType.FIELD) @XmlSeeAlso(value={SdhPort.class, EthernetPort.class}) @XmlType(name="Port") public abstract class Port implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @XmlElement(name = "id") private String id; @Column(name = "LABEL", length = 125) @XmlElement(name = "label") private String label; @ManyToOne @XmlIDREF private Card card; @Column(name = "DESCRIPTION", length = 125) @XmlElement(name = "description") private String description; @Version @XmlTransient private int version; public Port() { } public Port(String label) { this.label = label; } public String getId() { return id; } public void setId(String id) { this.id = id; } public Card getCard() { return card; } public void setCard(Card card) { this.card = card; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public String toString() { return "Port{" + "id=" + id + ", label=" + label + '}'; } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus