No, you can't read a line into multiple beans - sorry! (I'm not sure what this would even look like - would you get a List<Object>
back?)
You have a few options:
Add a relationship between the objects
Then can use a mapping like
parent.fieldA, parent.child.fieldB
. In your scenario Address and BankAccount aren't related semantically, so I'd recommend creating a common parent (see next option)Add a common parent object
Then you can use a mapping like
parent.child1.fieldA, parent.child2.fieldB
. This is what you've suggested, but I'd recommend giving it a better name thanWrapper
- it looks like a customer to me!
Oh, and I'd recommend trying stuff out before posting a question - often you'll answer your own question, or be able to give more details which will get you better answers!