galera, criei um serviço web REST baseado na seguinte estrutura:

Bem, observando:
- para cada product eu tenho uma imagem
- para cada hotspot eu tenho um video
- uma relação de muitos para muitos entre product e hotspot
Mandei o IDE (Netbenas) criar um serviço REST a partir desse banco de dados, e ao dar GET em product eu consigo recuperar os dados de product e image relacionada a esse produto, porém os hotspots relacionados a esse product não estou conseguindo recuperar.
Vou postar aqui a classe entidade product e a hotspot para caso alguém puder ajudar, analisar se esqueci algo, agradeço.
Classe product
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entities;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
@Entity
@Table(name = "PRODUCT")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p"),
@NamedQuery(name = "Product.findByProductId", query = "SELECT p FROM Product p WHERE p.productId = :productId"),
@NamedQuery(name = "Product.findByTitle", query = "SELECT p FROM Product p WHERE p.title = :title")})
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Id
@Basic(optional = false)
@NotNull
@Column(name = "PRODUCT_ID")
private BigDecimal productId;
@Size(max = 550)
@Column(name = "TITLE")
private String title;
@Lob
@Column(name = "DESCRIPTION")
private String description;
@ManyToMany(mappedBy = "productCollection")
private Collection<Hotspot> hotspotCollection;
@JoinColumn(name = "IMAGE", referencedColumnName = "IMAGE_ID")
@ManyToOne(optional = false)
private Image image;
public Product() {
}
public Product(BigDecimal productId) {
this.productId = productId;
}
public BigDecimal getProductId() {
return productId;
}
public void setProductId(BigDecimal productId) {
this.productId = productId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@XmlTransient
public Collection<Hotspot> getHotspotCollection() {
return hotspotCollection;
}
public void setHotspotCollection(Collection<Hotspot> hotspotCollection) {
this.hotspotCollection = hotspotCollection;
}
public Image getImage() {
return image;
}
public void setImage(Image image) {
this.image = image;
}
@Override
public int hashCode() {
int hash = 0;
hash += (productId != null ? productId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Product)) {
return false;
}
Product other = (Product) object;
if ((this.productId == null && other.productId != null) || (this.productId != null && !this.productId.equals(other.productId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entities.Product[ productId=" + productId + " ]";
}
}
E a classe hotspot
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entities;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
@Entity
@Table(name = "HOTSPOT")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Hotspot.findAll", query = "SELECT h FROM Hotspot h"),
@NamedQuery(name = "Hotspot.findByHotspotId", query = "SELECT h FROM Hotspot h WHERE h.hotspotId = :hotspotId"),
@NamedQuery(name = "Hotspot.findByX", query = "SELECT h FROM Hotspot h WHERE h.x = :x"),
@NamedQuery(name = "Hotspot.findByY", query = "SELECT h FROM Hotspot h WHERE h.y = :y"),
@NamedQuery(name = "Hotspot.findByWidth", query = "SELECT h FROM Hotspot h WHERE h.width = :width"),
@NamedQuery(name = "Hotspot.findByHeight", query = "SELECT h FROM Hotspot h WHERE h.height = :height"),
@NamedQuery(name = "Hotspot.findByTitle", query = "SELECT h FROM Hotspot h WHERE h.title = :title"),
@NamedQuery(name = "Hotspot.findByLink", query = "SELECT h FROM Hotspot h WHERE h.link = :link")})
public class Hotspot implements Serializable {
private static final long serialVersionUID = 1L;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Id
@Basic(optional = false)
@NotNull
@Column(name = "HOTSPOT_ID")
private BigDecimal hotspotId;
@Column(name = "X")
private BigInteger x;
@Column(name = "Y")
private BigInteger y;
@Column(name = "WIDTH")
private BigInteger width;
@Column(name = "HEIGHT")
private BigInteger height;
@Size(max = 200)
@Column(name = "TITLE")
private String title;
@Lob
@Column(name = "DESCRIPTION")
private String description;
@Size(max = 200)
@Column(name = "LINK")
private String link;
@JoinTable(name = "PRODUCT_HAS_HOTSPOT", joinColumns = {
@JoinColumn(name = "HOTSPOT_HOTSPOT_ID", referencedColumnName = "HOTSPOT_ID")}, inverseJoinColumns = {
@JoinColumn(name = "PRODUCT_PRODUCT_ID", referencedColumnName = "PRODUCT_ID")})
@ManyToMany
private Collection<Product> productCollection;
@JoinColumn(name = "VIDEO", referencedColumnName = "VIDEO_ID")
@ManyToOne(optional = false)
private Video video;
public Hotspot() {
}
public Hotspot(BigDecimal hotspotId) {
this.hotspotId = hotspotId;
}
public BigDecimal getHotspotId() {
return hotspotId;
}
public void setHotspotId(BigDecimal hotspotId) {
this.hotspotId = hotspotId;
}
public BigInteger getX() {
return x;
}
public void setX(BigInteger x) {
this.x = x;
}
public BigInteger getY() {
return y;
}
public void setY(BigInteger y) {
this.y = y;
}
public BigInteger getWidth() {
return width;
}
public void setWidth(BigInteger width) {
this.width = width;
}
public BigInteger getHeight() {
return height;
}
public void setHeight(BigInteger height) {
this.height = height;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
@XmlTransient
public Collection<Product> getProductCollection() {
return productCollection;
}
public void setProductCollection(Collection<Product> productCollection) {
this.productCollection = productCollection;
}
public Video getVideo() {
return video;
}
public void setVideo(Video video) {
this.video = video;
}
@Override
public int hashCode() {
int hash = 0;
hash += (hotspotId != null ? hotspotId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Hotspot)) {
return false;
}
Hotspot other = (Hotspot) object;
if ((this.hotspotId == null && other.hotspotId != null) || (this.hotspotId != null && !this.hotspotId.equals(other.hotspotId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entities.Hotspot[ hotspotId=" + hotspotId + " ]";
}
}
Obrigado!