Hi,
I have a problem with a composed-id.
I have a table "Translation" that has a composed primary key (idTranslation, idLocale), where idLocale is a FK to the PK of table Locale.
So, the following data
(1,"en","Die Hard")
(1,"es","La Jungla de Cristal")
means that both Strings are different translations of the same movie title.
Now, the value for column idTranslation should be auto-generated when new titles are added, and assigned when a new translation of an existing title is added.
So, I wrote an Interceptor and overridden the onSave() method. Inside there, I want to call some Hibernate implementation for generating the next idTranslation. The question is, how?
I tried to use IdentifierGeneratorFactory, but it takes some parameters I don't have inside onSave(). The same for IdentifierGenerator.
Any help?
Thanks,
Mariano.
|