Hi All,
How can I convert from DataRecod to My Object?
I am using hibernate and i need to convert (after i import the data) from DataRecod to a certain Object coz I want o use it as an object (for save in my DB).
thanks,
Waseem
Hi All,
How can I convert from DataRecod to My Object?
I am using hibernate and i need to convert (after i import the data) from DataRecod to a certain Object coz I want o use it as an object (for save in my DB).
thanks,
Waseem
Hi !
Not sure what do you mean by converting DataRecord to MyObject ? DataRecord is an object (with DataFields “embedded”). You may create a method, which copies DataRecord’s content into your “MyObject”. You may also create/inherit from DataRecord to add methods which you may need for Hibernate.
Hi,
I believe the most simple way is …
a] copy fields key-value pairs from DataRecord to some Map instance, i.e. HashMap
or
b] implement wrapper class of DataRecord implementing Map interface
Map can be easily persisted by hibernate …
http://docs.jboss.org/hibernate/stable/ … amicmodels
Mapping of DataRecord fields to DB table columns must be specified in hibernate XML mapping file.