hbm2ddl

Using NHibernate to create an SQLite database with a "UNIQUE ON CONFLICT REPLACE" column.

Is this possible? If not, how can I create a table with a "UNIQUE ON CONFLICT REPLACE" column in code? ...

Passing parameter to hbm2ddl

I have parametrized persistence.xml. I am trying to generate ddl schema using hbm2ddl. How can i pass parameters to this tool ? My persistence.xml looks like <property name="hibernate.connection.driver_class" value="${persistence.connection.driver.class}"/> <property name="hibernate.dialect" value="${persistence.dialect}"/> <property n...

Hibernate: hibernate.hbm2ddl.auto=update show generated sql

I wish to pass to Hibernate's SessionFactory hibernate.hbm2ddl.auto=update and see in log file generated sql statements. Is it possible w/o java coding (know how to achieve the result with SchemaExport, but hope that hibernate has "in box" solution) ...

How to reserve a set of primary key identifiers for preloading bootstrap data

We would like to reserve a set of primary key identifiers for all tables (e.g. 1-1000) so that we can bootstrap the system with pre-loaded system data. All our JPA entity classes have the following definition for the primary key. @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false, insertable =...

Hibernate - hibernate.hbm2ddl.auto = validate

I am interested in how hibernate.hbm2ddl.auto=validate actually works and I am struggling to find comprehensive documentation. We've recently discovered production system was affected by http://opensource.atlassian.com/projects/hibernate/browse/HHH-3532 (Hibernate matches foreign keys on name, rather than signature and so will recreate ...

hibernate3-maven-plugin: entiries in different maven projects, hbm2ddl fails

I'm trying to put an entity in a different maven project. In the current project I have: @Entity public class User { ... private FacebookUser facebookUser; ... public FacebookUser getFacebookUser() { return facebookUser; } ... public void setFacebookUser(FacebookUser facebookUser) { this.facebookUser = facebookUser; } Then Fa...

How to get hibernate3-maven-plugin hbm2ddl to find JDBC driver?

I have a Java project I am building with Maven. I am now trying to get the hibernate3-maven-plugin to run the hbm2ddl tool to generate a schema.sql file I can use to create the database schema from my annotated domain classes. This is a JPA application that uses Hibernate as the provider. In my persistence.xml file I call out the mysq...

Best approach for Java/Maven/JPA/Hibernate build with multiple database vendor support?

I have an enterprise application that uses a single database, but the application needs to support mysql, oracle, and sql*server as installation options. To try to remain portable we are using JPA annotations with Hibernate as the implementation. We also have a test-bed instance of each database running for development. The app is bui...

How to output two ddl files at the same time with using maven hbm2ddl plugin

Our application needs to use two different kinds of databases.One is oracle, the other is mysql and we want to use maven plugin hbm2ddl to generate the ddl file, and want to output the two ddl files at the same time, I don't know how to set the configuration in pom.xml. I tried to use this plugin twice, but it always generated one ddl fi...

How to keep hibernate3-maven-plugin HBM2DDL from printing to console

I used the hibernate3-maven-plugin to automatically create a SQL script I can use to create a database schema in a new database. I do this via the hbm2ddl tool. I thought that when I instructed it to write the SQL to a file it would stop cluttering up my maven builds with 50 pages of SQL. Anyway to make it stop writing to the console ...

How to disable sql creation for JPA entity classes

We have some JPA entity classes which are currently under development and wouldn't want them as part of the testing cycle. We tried commenting out the relevant entity classes in META-INF\persistence.xml but the hbm2ddl reverse engineering tool still seems to generate SQL for those entities. How do I tell my code to ignore these classes? ...

Hot to turn off hbm2ddl?

I couldn't find a reference on how to switch hbm2ddl off. ...

Is it possible to generate a default value for a certain database column using hbm2ddl

Env: JPA 1, Hibernate 3.3.x, MySQL 5.x We auto generate database schema using hbm2ddl export operation. Would it be possible to generate a default value for a certain @Entity member during SQL generation. (e.g. archive field in mytable entity class. create table mytable ( ... 'archive‘ tinyint(1) default ’0 ’, ... ) ...

Stop Maven's hibernate3-maven-plugin from logging to console?

I can control hibernate logging from within my application just fine, but during a system build, the hibernate3-maven-plugin runs hbm2ddl and this is spewing tons of useless INFO log messages to the console: 21:51:57,383 INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA 21:51:57,394 INFO org.hibernate.cfg.Env...

Can I create both MyISAM and InnoDB tables in the same database using Hibenrate hbm2ddl

I need both MyISAM tables and InnoDB tables in my database, I am using hbm2ddl to create them. Can I create both MyISAM and InnoDB tables in the same database using Hibenrate hbm2ddl? It seems that selecting the dialect forces me to use one or the other. ...

Schema export with hibernate annotations

I'm using hibernate annotations and i want to export my database schema. Similar to the schemaexporttask with hbm xml files. ...

Problem adding @ManyToOne mapping on Non primary-key in SQL Server

I have a problem with changing my spring/hibernate application from MySql to SQL Server. When Hibernate is updating the database by starting the server he want to creates(by hibernate.hbm2ddl.auto set on update ) the database but a foreign-key fails on following error: Unsuccessful: alter table table2 add constraint FKDC2DC97ECEB31922 ...

Hibernate is not auto creating sequencies to database when using auto creating of tables

I want to create my database tables automatically with Hibernate and Postgresql, but I get errors about sequences. Is it possible to auto create sequences too with Hibernate, or do I have generate sequences manually? Example of my entity: import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence...

Simple setup for maven hbm2ddl

I am setting up maven to take annotated java classes and produce some DDL which varies depending on the database. Is there a better way to do this? It seems like I should be able to filter the input to the hbm2ddl plugin (as part of a pipeline) rather than tell it to operate on the output of resource filtering (which I then must filter...

Hibernate hbm2ddl ant file paths

Hello, I am having troubles with generating database schema with Hibernate Tools. This is my ant file <project name="Schema generator for MySQL database" basedir="."> <description> This file is used for running Hibernate Tools Ant task. It is used to generate database schema based on hibernate configuration </description> ...