However, when I comment out the statements that create and delete the objects (as I have done below), I expect to see it display the same greetings and messages. Instead, no messages are being retrieved. Apparently something is recreating the database tables every time I run the program. What do change so I can run this program and see the data previously entered into the database?
posted 8 years ago
This is configured in persistence.xml by property: <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
possible values for this are create-tables, drop-and-create-tables,none
So I think that by removing that property form persistence.xml preserves your data.