Interfaces with hibernate annotations

Posted by molleman on Stack Overflow See other posts from Stack Overflow or by molleman
Published on 2010-04-06T16:40:46Z Indexed on 2010/04/06 16:43 UTC
Read the original article Hit count: 539

Filed under:
|
|
|
|

Hello

i am wondering how i would be able to annotate an interface

@Entity
@Table(name = "FOLDER_TABLE")
public class Folder implements Serializable, Hierarchy {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "folder_id", updatable = false, nullable = false)
private int fId;
@Column(name = "folder_name")
private String folderName;
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "FOLDER_JOIN_FILE_INFORMATION_TABLE", joinColumns = 
{ @JoinColumn(name = "folder_id") }, inverseJoinColumns = 
{ @JoinColumn(name = "file_information_id") })
private List< Hierarchy > fileInformation = new ArrayList< Hierarchy >();

above and below are 2 classes that implement an interface called Hierarchy, the folder class has a list of Hierarchyies being a folder or a fileinformation class

@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 ieId;
@Column (name = "location")
private String location;

i have serached the web for someway to annotate or a workaround but i cannot map the interface which is simply this

public interface Hierarchy {

 }

i get a mapping exeception on the List of hierarchyies with a folder but i dont know how to map the class correctly

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about gilead