Is it possible to group records belonging to an entity in dbunit?

Posted by Joshua on Stack Overflow See other posts from Stack Overflow or by Joshua
Published on 2010-04-24T16:39:33Z Indexed on 2010/04/24 16:43 UTC
Read the original article Hit count: 306

Filed under:

Our JPA entity model auto-generates primary key identifiers for user, user_address tables. Would it be possible to group these entities given below via dbunit, so that I don't need to provide neither the primary key as well as the foreign key reference from user_address.user_id. It is getting very hard to maintain these keys (i.e. I would prefer to group the primary record 'user' and the child records 'user_address' so that dbunit can group them automatically by looking up the entity metadata). Is it achievable?

<user    id="1"
         first_name="Josh"
         creation_date="2009-07-11 15:45:28"/>

<user_address id="1"
              user_id="1"
              address="Main St"
              city="Los Angeles"/>

I would prefer something like this

<!-- First user -->
<user first_name="Josh"
      creation_date="2009-07-11 15:45:28"/>

<user_address address="Main St"
              city="Los Angeles"/>


<!-- Second user -->
<user first_name="Mary"
      creation_date="2009-07-11 15:45:28"/>

<user_address address="Taylors St"
              city="San Jose"/>

© Stack Overflow or respective owner

Related posts about dbunit