hbm2ddl

Hibernate: hbm2ddl.auto=update in production?

Is it okay to run Hibernate applications configured with hbm2ddl.auto=update to update the database schema in a production environment? ...

Hibernate question hbm2ddl.auto possible values and what they do

I really want to know more about the update, export and the values that could be given to hbm2ddl.auto. I need to know when to use the update and when not? And what is the alternative? These are changes that could happen over DB: New tables new columns in old tables columns deleted data type of a column changed a type of a column chan...

How to find a JNDI resource inside the hibernatetool Ant task

I want to generate my database schema with Ant. I am using hbm2ddl task. I am using Hibernate with JNDI. My hibernate.cfg.xml looks like: <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; <hibernate-config...

Hibernate Validator: EmbeddedId constraint ignored by hbm2ddl

Hi all, Fairly specific question here, but it's been bugging me for a day now: I'm using Hibernate Core, Annotations & Validator on PostgreSQL 8.3. I have the following classes setup: @Entity @Inheritance(strategy = InheritanceType.JOINED) public class Entry { @EmbeddedId protected EntryPK entryPK; @ManyToMany priva...

Using hibernate hbm2ddl.auto=update : How can I alter column not to require value anymore?

I had a property that used to be not-null="true". Values aren't necessary for that field anymore so I changed it to not-null="false" but the table does not get updated in the database. Adding new properties doesn't give any problems. Is it possible for hbm2ddl.auto=update to change the the table automatically to remove the not-null="tr...

How to creata database Schema using Hibernate

After reading Hibernate: hbm2ddl.auto=update in production? some questions arose. First of all, the reason for I'm using Hibernate is to be database vendor independent (no need to write 10 versions of the "same" sql query, eg. tsql vs. sql). My problem appears when it's time to create the database schemas (production environment). As f...

manual initialization of required Hibernate database tables

I'm getting started in Hibernate and so far it's not too hard. But I am confused about the hbm2ddl.auto property. Is there a way to manually execute whatever this does to initialize the database tables? I only want to do this after I make my database changes, not every time I run my program. edit: what about at runtime? is there a way i...

NHibernate SchemaExport and Configure() catch-22

I want to use DDD in a new project and model my classes first, then generate the database schema based on the class library. My plan is to do this with the NHibernate hbm2ddl tool SchemaExport. The problem is that I can't get the SchemaExport to work because of a weird catch-22 problem it puts me in. The SchemaExport requires a Configur...

Db migrate - Hibernate/JPA - hbm2ddl - diff tools...

Hello I use - EJB3 / JPA (hibernate) - MySQL 5 I have to set up a system to help database migrations. Tried to use LiquiBase but it seems not enough mature yet to be used with Hibernate. What i would like to do is: - I have version 1.0 of the application in production - I have version 2.0 of the application developped and tested - I ...

Clone a Table's definition with Hibernate (hbm2ddl)

In my hibernate application there is annotation driven object: AuditEvent. Its very simple and has no foreign key relationships. I archive old entries in this table by moving them to another table OldAuditEvent, which is a clone of the AuditEvent table. Right now we generate the DDL for the entire application using hbm2ddl (on our a...

HIbernate schema update error

Hi everyone, During the startup of Jboss server, I get the following stacktrace. I wonder why JPA is trying to alter tables that seem to be fine and how to get passed these ERROR messages. Thanks 2009-08-03 11:28:49,683 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] Unsuccessful: alter table BDPARAMS add constraint FK61733C48FA34BFDC f...

NHibernate and hbm2dll update attribute

Hi, i'm using NHibernate with Sdf database. In my hibernate.cfg.xml file i've set: <property name="hbm2ddl.auto" value="update"/> But this does not seem to work at all. "Update" attribute should make NHibernate generate missing tables and columns during application launch, but it does not happen. If i want missing tables geenrated I...

hbm2ddl on a column based on GenericEnumUserType

The following JPA column definition generates an "integer" data type by default on all databases (e.g. h2, mysql, postgres) @Column(name = "type", nullable = false) @Type(type = "com.mycompany.hibernate.usertype.GenericEnumUserType", parameters = { @Parameter(name = "enumClass", value = "com.mycompany.model.DegreeType"), ...

In-MemoryDB: create schema in 'setUp()' of Unit Testing: Netbeans (6.5.1) Hibernate (3) Junit(3), HSQL (1.8)

What are the steps needed to setup an in-memory DB, build the schema automatically with Hibernate's 'hbm2ddl' tool within a Junit (3) 'setUp()' using Netbeans 6.5.1 ? I'm not using Hibernate annotations - just a mapping file. For the actual code, I want to use an on-disk database of course. [that is the Junits live a separate 'test' pac...

Hibernate, MySQL Views and hibernate.hbm2ddl.auto = validate

I can use MySQL views in Hibernate by treating them like tables - ie. the entity is no different than one created for a table. However my application won't deploy when Hibernate is set to validate the model as it can't find the View as it assumes it's a table. Is it possible to use Hibernate Entities with deploy time validation turned o...

Is there a way to get Hibernate's hbm2ddl Ant task to exclude specific tables?

I use Hibernate to generate my database automatically for testing, and I have some tables in my schema that contain static data that takes a very long time to import. In the past, I've used the following code in my build file to generate the database (from mapping files): <target name="schema-gen" depends="hibernate-gen"> <taskdef n...

Hibernate hbm2ddl and SQL Server: Long as column of numeric data type

Hibernate generates column of type “numeric” in SQL Server for properties of type Long of Java class. Is there a way to make Hibernate generate bigint (or int) column instead of numeric using the Hibernate hbm2ddl? ...

Is it possible to create indices on join table using Hibernate annotations and hbm2ddl?

I have a two entities in many-to-many association. Hibernate creates a join table for this association if hbm2ddl is activated. However, since I do not have an entity for this table, I can not apply @Index annotation. Is there a way to tell hibernate hbm2ddl to generate indices and primary key on the join table? ...

constraint problems using apache derby and hbm2ddl

We are using Apache Derby 10.5.3.0_1 and hbm2ddl with Hibernate 3.3.x I get the following constraints error while pre-loading the SQL on an embedded derby database. If I remove the primary key(id) from the create table sql, it's able to create the table. Not sure what the problem is over here. create table user_flow (id integer not nul...

How can I turn off the majority of hbm2ddl's output in the console in Ant?

By default, hbm2ddl spits a ton of output to the console when executing the ant task. I'd like to turn this completely off and simply look at the schema file if something has gone wrong. Anyone know how to do that? ...