I have been trying to persist an object which has a Composite ID.
TABLEUSER
ID - auto_increment
name
TABLEUSER2
userid (foreing key from tableUSER)
keynum2
I have tried lareadt with the @EmbeddedId annotation. The problem is that I'm trying to get the foreign key as follows
@GeneratedValue(generator = "foreign")
@GenericGenerator(
name = "foreign",
strategy = "foreign",
parameters = {@org.hibernate.annotations.Parameter(name = "property", value = "user")})
This would work perfect if it was a single key in TABLE USER, but as it's a composite ID I cannot set it.
Is there a way to do so?