Create the Embedded class instance within your entity when creating your
entity. @GenerateValue provides a pk *value* for a field it does not
create an embedded class instance.
--Gordon
Markus KARG wrote:
> I am using @EmbeddedId to reference my @Embeddable PK class.
> The PK class is using @GeneratedValue(strategy = IDENTITY).
> The table's PK column is AUTOINCREMENT'ing.
>
> When running this code, I get a new row in the table, including a
> unique ID:
>
> em.getTransaction().begin();
> CostDescription c = new CostDescription();
> c.setDescription("Test3");
> em.persist(c);
> em.getTransaction().commit();
>
> But the field marked as @EmbeddedId always stays null.
>
> I tried using em.refresh(c), but TopLink says "Entity no longer exists
> in the database" (what is not true: the row actually is to be found in
> the db).
>
> Any ideas how to get it running?
>
> Thanks
> Markus
>