I've got a problem, one of my entities (A) has a composite primary key, this PK is composed by an Integer which identifies another entity (B) and two strings more, so the three of them identifies this entity (A), here is the problem, can I implement this using Hibernate ??? or I should have a surrogate key instead of this primary key, in that case I suppose I should have an Unique index, indexing all three fields in order to maintain the restrictions of a primary key in those fields.
My Daos should implement a GenericDao parameterized by the type of the Entity, and the type of the primary key, and my primary key don't have a type !!!
Can you help me ???
I found some examples using composite keys, but in all of them, the keys identifies different entities, so you can write another object with an @Embeddable annotation with all the keys, but I get lost because of these two strings, that they don't identify anything at all.
I think I should use the surrogate key option, am I correct ???
What do you think ? Any idea ?? I don't find something like this in google :S