user2321728
user2321728

Reputation: 1373

Why couldn't I see data committed to Postgres database from spring hibernate program?

I am trying to program using spring, JPAhibernate, and Postgres. There is no error running the program, and it successfully inserted data showing from client browser. However, Postgres database says relation "person" does not exist (My table name is "person"), which I think it means data is not committed to database. I tried

  1. clean browser cache, and restart server. But program can still retrieve correct items. It looks like they are stored in the database.

  2. set the hibernate.hbm2ddl.auto to be "validate" or "create-drop" or "update". But I can't see updated data in the database, even the table "person" doesn't exist.

Can anyone explain me why it's like this, or how can I see committed data in the database? Thank you.

Upvotes: 1

Views: 1758

Answers (2)

Craig Ringer
Craig Ringer

Reputation: 325051

The most common cause for this sort of thing is connecting to a different database, or a database of the same name on a different host/port, than you think you are. So you're not really modifying the same thing you are looking at.

Upvotes: 3

RPaul
RPaul

Reputation: 946

  <prop key="hibernate.hbm2ddl.auto">update</prop> 

you can set hibernate.hbm2ddl.auto=update to update your database with changes to your model

Upvotes: 0

Related Questions