views:

60

answers:

1

I'm a first-timer to this and would like to have some guidance regarding how to store objects in a database..

I have an object Person, with a couple of fields in it. I have one PersonContainer which loads all the objects from the database.

What is best of these two: (or if they both suck, tell me what's the right thing to do)

Store the object just as a XXX.store(new Person())

or

Store the object as in XXX.store(new BeanItem(new Person()))?

Whats "good practice" to do?

A: 

My recommendation would be to persist Business objects i.e. objects that represent a business concept of your particular domain, in your case Person, etc.

Actually, I suggest to have a look at the Adding JPA to the Address Book Demo page in the Vaadin wiki, you might find some useful information there.

Pascal Thivent