7

I'm using hibernate to auto-create some postgres database tables. Now I'd like to move one of the tables to a different location (harddrive).

This is done using tablespaces.

Question: how can I define the tablespace for an @Entity? Is that possible at all?

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911
membersound
  • 81,582
  • 193
  • 585
  • 1,120
  • 3
    Check out [Hibernate Oracle Tablespace Annotation](http://stackoverflow.com/questions/1274408/hibernate-oracle-tablespace-annotation). – OO7 Apr 27 '15 at 08:39
  • @membersound have a look at [this](http://www.ciiycode.com/0HSS6eWgeqgg/hibernate-oracle-tablespace-annotation) – Ankur Singhal Apr 27 '15 at 09:41
  • That's really lots of work to create an own `hbm2ddl` tool for this requirement... – membersound Apr 27 '15 at 10:00

1 Answers1

1

As of 4.3.9 version, there's no support for tablespaces in Hibernate, which leaves you with two options:

  1. You either customize the hbmddl generation to include the tablespace as previously suggested.

  2. You let go hbmddl and simply use your own incremental database schema generation. FlywayDB is both simple and powerful, and you can get the most control over the database schema generation.

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911
  • I agree, Hibernate should not manage the DDL stuff (although I prefer Liquibase over Flyway) –  Apr 27 '15 at 11:06