by
1
6
2,307
0
Top 1% !
Popular
Famous
Tagged
Specified
OpenSource
Popularity: 7896th place

Published on:

LanguageJava
LicenseMIT_X11

EquipmentController java class - Integration of JPA and JAXB Java classes

This class refers to a unique Equipment class, using OneToOne annotation.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/43636/EquipmentController-java-class---Integra?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.Column; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.xml.bind.annotation.*; @XmlAccessorType(XmlAccessType.FIELD) @Entity @Table(name = "EQUIPMENT_CONTROLLER") public class EquipmentController implements Serializable { @XmlElement(name = "id") @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @XmlElement(name = "label") @Column(name = "LABEL", length = 125) private String label; @XmlTransient @OneToOne private Equipment equipment; @XmlElement(name = "controllerAddress") @Embedded private ControllerAddress controllerAddress; public EquipmentController() { } public EquipmentController(String label) { this.label = label; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public Equipment getEquipment() { return equipment; } public void setEquipment(Equipment equipment) { this.equipment = equipment; } public ControllerAddress getControllerAddress() { return controllerAddress; } public void setControllerAddress(ControllerAddress controllerAddress) { this.controllerAddress = controllerAddress; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "EquipmentController [id=" + id + ", label=" + label + ", controllerAddress=" + controllerAddress + "]"; } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus