Come faccio ad aggiungere commenti personalizzati per uscita hbm2ddl Hibernate?

StackOverflow https://stackoverflow.com/questions/5303341

  •  24-10-2019
  •  | 
  •  

Domanda

ero curioso di sapere se è possibile aggiungere un commento intestazione SQL per l'SQL generato dall'uscita hbm2ddl.

In particolare, sarebbe bello se potessi aggiungere stringhe di versione generate all'oggetto Dialetto che sarebbe uscita per il file sql generato.

public static MyDialect extends MySQLDialect {
 // what method do I @Override to generate the comment?
}
È stato utile?

Soluzione

The answer (to my own question) is that you cannot currently do this. The current version of hibernate (version 4.alpha 03/2011). Their github master SchemaExporter class (https://github.com/hibernate/hibernate-core/blob/master/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaExport.java) only outputs two things to the file 1) the drop table commands then 2) the table creation commands.

If I get time maybe I'll add the feature. The idea is that we could add database versioning to the generated script as a comment header.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top