Is there a way in JPA 2 to use a @JoinTable to generate a UUID key for the id of the row? I do not want to create new entity for this table (even if that would solve the problem) and I do not want to create it from the DB.
@ManyToMany
@JoinTable(name="Exams_Questions", schema="relation",
joinColumns = @JoinColumn(name="examId", referencedColumnName="id"),
inverseJoinColumns = @JoinColumn(name="questionId", referencedColumnName = "id"))
private List<Question> questions = new ArrayList<Question>();
db table
CREATE TABLE [relation].[Exams_Questions](
[id] [uniqueidentifier] PRIMARY KEY NOT NULL,
[examId] [uniqueidentifier] NOT NULL,
[questionId] [uniqueidentifier] NOT NULL,