Customer Portal

How can I convert from DataRecod to My Object?

Comments 2

  • Avatar
    dpavlis
    0
    Comment actions Permalink
    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.
  • Avatar
    mvarecha
    0
    Comment actions Permalink
    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.

Please sign in to leave a comment.