For native TopLink you primary key is defined in terms of fields (columns), you only need to set the column names. The primary key is defined independently of the object's attributes/mappings. You can map the column any way that you wish (direct, aggregate, one-to-one), in your case you would have an AggregateObjectMapping to your embedded id.
I am clear about the concept about defining annotation based composite key. Also, I read in the documentation that I'll be needing to define as direct, aggregate or one-to-one. But, I am not able to define and run the same in the project mapping xml of toplink.
It would be great if you can share some sample code for defining the same. For e.g. in my mentioned example, there is TestEntity POJO having 'id' as the attribute which gets populated with the testEntityCode of the TestEntityKey POJO. Please suggest the same for the same: