So I'm stuck, I am creating a gwt web application, I will use the tree structure (gwt Tree and TreeItems) to show a list of folders (Folder class) and files (FileLocation class), the folder and file class will implement a hierarchy interface based on classes on a compound template. but I use hibernate to store my data, and I use annotations to map the data in the database. my problem is that I don’t know how to comment on my interface.
if any of you guys used a composite template storing data with hibernate
public interface Hierarchy(){
}
@Entity
@Table()
public class Folder implements Serializable, Hierarchy {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "folder_id", updatable = false, nullable = false)
private int id;
@OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
@JoinTable(name = "FOLDER_FILELOCATION", joinColumns = {
@JoinColumn(name = "folder_id") }, inverseJoinColumns = {
@JoinColumn(name = "file_information_id") })
private List<Hierarchy> children = new ArrayList<Hierarchy>() ;
@Column(name = "folder_name")
private String folderName;
@Column(name = "tree_item")
private TreeItem item;
@Column (name = "parent")
private Hierarchy parent;
@Entity
@Table(name = "FILE_INFORMATION_TABLE")
public class FileInformation implements Serializable, Hierarchy {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "file_information_id", updatable = false, nullable = false)
private int fiId;
@Column (name = "location")
private String location;
@Column(name = "tree_item")
private TreeItem item;
@Column (name = "parent")
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
@JoinTable(name="FOLDER_FILELOCATION",
joinColumns = @JoinColumn(name="filelocation_id"),
inverseJoinColumns = @JoinColumn(name="folder_ID"))
private Hierarchy parent;
source
share