Tell hibernate hbm2ddl not to create separate tables

Is there a way to tell hibernate hbm2ddl not to create a specific table, but you can still recognize the Hibernate model.

The fact is that the model is mapped to the view, and I want to have a database in memory (empty at startup and deleted at the end) for testing, therefore, the presence of two sets of mappings is out of the question.

+3
source share
3 answers

Well, this certainly does not answer the question (there is probably no way to do this with the current version), but it solves the problem.

, hibernate , create view. , 2 .

- <database-object>, <create>, :

<class table="MY_VIEW"></class>
<database-object>
  <create>
    drop table MY_VIEW;
    create view MY_VIEW etc etc;
  </create>
</database-object>

import.sql. . , , , . , , . , , ( ).

+1

hibernate hbm2ddl

AFAIK, hbm2ddl - " ", . DDL , DDL. ?

Hibernate.

. Hibernate validate ?

0

. , , "" (//etc). hbm2ddl , SQL .

, Perl script SQL. script, :

cat your-sql-file.sql | scrub-schema.pl table1 table2 table3 ... > scrubbed.sql

( Apache v2):

https://github.com/cobbzilla/sql-tools/blob/master/scrub-schema.pl

I hope this will be helpful.

0
source

Source: https://habr.com/ru/post/1764641/


All Articles