What is the JPA equivalent to Hibernate’s foreign id generator?
<id column="PERSON_ID" name="id" type="java.lang.Long">
<generator class="foreign">
<param name="property">person</param>
</generator>
</id>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
AFAIK , JPA specification does not standardize the foreign ID generator . You have to programmatically set the PK value correctly before saving this instance.
As for Hibernate , it has an extension annotation to enable foreign ID generator . You may choose to use it if you don’t mind: