'Hibernate Jpa: update on @Embeddable table generates a query using the wrong table which @Embedded

I have the database tables Person and Details. Details are intended to carry the miscellaneous fields for the Person using the foreign key PERSON_ID.

JPA code has the following equivalent java classes,

@Entity
public class Person{

    /**
    other fields 
    **/ 

   @Embedded
   private Details details;

}

@Embeddable
public class Details{
    /**
    own fields
    **/

}

I am able to read the Details corresponding to the Person using hibernate/JPA code.

But when I try to update the fields in the Details table, hibernate generates the update query on the Person table instead of the Details table.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source