{"id":406,"date":"2008-07-05T17:30:53","date_gmt":"2008-07-05T22:30:53","guid":{"rendered":"http:\/\/www.wwco.com\/~wls\/blog\/?p=406"},"modified":"2008-07-05T17:30:53","modified_gmt":"2008-07-05T22:30:53","slug":"hibernate-schema-update-problems","status":"publish","type":"post","link":"https:\/\/wls.wwco.com\/blog\/2008\/07\/05\/hibernate-schema-update-problems\/","title":{"rendered":"Hibernate Schema Update Problems"},"content":{"rendered":"<p>I&#8217;ve been using <a href=\"http:\/\/www.hibernate.org\/\">Hibernate<\/a> for relational persistence for a while now, and I have to say it&#8217;s been working out pretty well.<\/p>\n<p>That was, until I went to do a <a href=\"http:\/\/www.hibernate.org\/hib_docs\/v3\/api\/org\/hibernate\/tool\/hbm2ddl\/SchemaUpdate.html\">SchemaUpdate<\/a>.<\/p>\n<p>The moment I did an alternation of a table, or created a new entity, things went sour, and I was unable to read my old data.  Was it me, or was it Hibernate?<\/p>\n<blockquote><p>could not initialize a collection<br \/>\nPSQLException: ERROR: permission denied for relation <em>newtablejustadded<\/em><\/p><\/blockquote>\n<p><strong>It was me.<\/strong><\/p>\n<p>Turns out Hibernate&#8217;s update was working just fine.  There was no magic versioning or class hashing going on, detecting the change to the database.<\/p>\n<p>The problem was the ACL was blank for the newly created entity table (I was using Postgres).<\/p>\n<p>By issuing this command, all was fine again:<\/p>\n<blockquote><p>GRANT INSERT, SELECT, UPDATE, DELETE, REFERENCES ON newtable TO GROUP <EM>agroupIwasusing<\/EM>;<\/p><\/blockquote>\n<p>Since it took a while to figure out what was going on, I thought I&#8217;d post this to help others that follow a similar, yet frustrating, path.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For a while I&#8217;ve been having problems trying to get a SchemaUpdate working with Hibernate.  Turns out the problem was me, not Hibernate.  Newly created tables had a blank ACL, and I just needed to set them.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62,124,67,86,92,95],"tags":[175,176,488,513,529,725,726,749],"class_list":["post-406","post","type-post","status-publish","format-standard","hentry","category-geek","category-hibernate","category-how-to","category-programming","category-software","category-sql-programming","tag-acl","tag-acls","tag-gotcha","tag-hibernate","tag-howto","tag-permission","tag-permissions","tag-postgres"],"_links":{"self":[{"href":"https:\/\/wls.wwco.com\/blog\/wp-json\/wp\/v2\/posts\/406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wls.wwco.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wls.wwco.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wls.wwco.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wls.wwco.com\/blog\/wp-json\/wp\/v2\/comments?post=406"}],"version-history":[{"count":0,"href":"https:\/\/wls.wwco.com\/blog\/wp-json\/wp\/v2\/posts\/406\/revisions"}],"wp:attachment":[{"href":"https:\/\/wls.wwco.com\/blog\/wp-json\/wp\/v2\/media?parent=406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wls.wwco.com\/blog\/wp-json\/wp\/v2\/categories?post=406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wls.wwco.com\/blog\/wp-json\/wp\/v2\/tags?post=406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}