We are using DFP API in our project. Since this is a third party library, we don’t have access to its classes. In turn we cannot annotate those classes with @Entity for persistence.
Correct me if I’m wrong, we have to use XML mapping such as orm.xml in such situations right?
But, some times the objects are so big that its very time consuming to map each variable and the object (Please refer the previous link).
In such situations, how can I configure XML to consider all fields in that class for mapping or do I need to map each fields?
How to store additional columns apart from that an object already has. for example, a class ‘Person’ contains id, name and address attributes, I need to store one more column called “iteration_no”, but I cannot add that new column inside “Person” class because, its a third party class and I don’t have access to it.
How to overcome the above challenge?
Assume I have added new column by native query using “ALTER TABLE person …” (If that’s the actual way of adding new column other than class attributes), later when I retrieve the data from “Person” table, can I get only those data which belongs to “Person” class? eg: only id, name and address values but not “iteration_id”?
You can use multiple entity classes mapped to the same table.
So, you can have both the Person entity and a new entity that has all the person properties plus the “iteration_no” and have that mapped to the same table.