Announcement Announcement Module
No announcement yet.
Where to load hibernate associations Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Where to load hibernate associations


    I have to parse and import a txt flatfile to a hibernate domain named Domain1.

    I have planned to create a SimpleStepFactoryBean with a FlatFileItemReader and a HibernateItemWriter.

    Every record I read from the file has a column named domain2id wich is the id of another hibernate object of type Domain2 already present in the db.

    I thinking of loading the the associated domain2 object in the ItemReader doing

    Domain1 d = new Domain1() = fieldSet.readInt(0)

    Domain1.domain2 = Domain2.load( fieldSet.readInt(1) )

    return d

    It this the best way to proceed?