Hi,
if I map a 1:n relation on the 1-side, I will get an Jointable as Databasetable.
Which I would prefer, cause of performance issues, is to map it on the n-side, without changing my java code. (unidirectional relation instead of bidirectional)
So on the n-side of the relation there is no attribut present, so no foreign key attribute is present in my javacode. Can I annotate the list in a way that the n-side gets implicit an foreign-key-attribute, rather than an join table?
Is this possible? How is this done with annotations?
E.g.:
Code:
@OneToMany(cascade = javax.persistence.CascadeType.ALL, fetch = FetchType.LAZY)
private List<PdfFile> listOfPdfs;
Code:
@Entity
@org.hibernate.annotations.Entity(dynamicUpdate = true)
public class PdfFile implements SupportsDatabaseId {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Lob
private String filename;
@Lob
private String comment;
/* Cause of postgreSql problems with BLOB's */
@Type(type = "org.hibernate.type.BinaryType")
private byte[] pdf;
So I would like to store the id of the object, which contains the list in the PdfFile without adding a attribute for it.
Thanks.
Greetings Michael