Questions tagged [hbm2ddl]

hibernate utility to manage the creation and/or deployment of database schemas (data definition language)

198 questions
7
votes
1 answer

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:
Sergio del Amo
  • 76,835
  • 68
  • 152
  • 179
7
votes
6 answers

Mapping a boolean with hibernate

I'm running into trouble with hibernate. I recently set my hbm2ddl to validate, and it has been complaining a lot about wrong datatypes. I have fixed every problem except for booleans. I have a field opener in my class, which is mapped as:…
Maarten Blokker
  • 604
  • 1
  • 5
  • 23
7
votes
3 answers

Mapping Java byte[] to MySQL binary(64) in Hibernate

I'm having some trouble mapping a byte array to a MySQL database in Hibernate and was wondering if I'm missing something obvious. My class looks roughly like this: public class Foo { private byte[] bar; // Getter and setter for…
spaaarky21
  • 6,524
  • 7
  • 52
  • 65
7
votes
1 answer

How does hibernate generate foreign key constraint names?

How does hibernate generate foreign key constraint names? If i do not define a name hibernate generates something like this CONSTRAINT fk_2ocepcfwpr1v18dg1ieoe6bau how is this name generated? Maybe from MD5 hash of field names or something like…
wutzebaer
  • 14,365
  • 19
  • 99
  • 170
7
votes
2 answers

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"…
FoxyBOA
  • 5,788
  • 8
  • 48
  • 82
7
votes
1 answer

Hibernate SchemaExport fails to first create schema

I am running tests using Arquillian, JBoss, JPA/Hibernate, H2 DB and Maven. In my test persistence.xml file I have: For now I have a…
lostdorje
  • 6,150
  • 9
  • 44
  • 86
7
votes
3 answers

ON DELETE CASCADE option not in generated when using ddl schema generation on Mysql

In a Maven-Spring-Hibernate-MySql running on Tomcat web app I'm using hibernate ddl to generate my DB schema with MySQL5InnoDBDialect. The schema is generated just fine except the cascade option for foreign-keys. For example I have this structure: A…
forhas
  • 11,551
  • 21
  • 77
  • 111
6
votes
3 answers

java.sql.SQLException: Schema 'ROOT' does not exist

i am using hibernate with embeded derby, and i want hibernate to create the database and the tables, so i tried the following configuration, but i am getting the error: java.sql.SQLException: Schema 'ROOT' does not exist here/s my configuration: …
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498
6
votes
2 answers

Shared sequence generator for IDs and DB scheme creation using hbm2ddl

all. I have an issue with DB scheme generation via hbm2ddl. I want to use shared sequence generator for all private keys. So I defined it once in some entity. @Entity @SequenceGenerator(name = "MY_SEQUENCE_GENERATOR", sequenceName = "MY_SEQ") public…
Vladimir
  • 163
  • 1
  • 1
  • 8
6
votes
1 answer

Hibernate Validator: EmbeddedId constraint ignored by hbm2ddl

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…
Tim
  • 19,793
  • 8
  • 70
  • 95
6
votes
2 answers

Schema is not dropped on hbmddl.auto = create.drop

I am using hbmddl.auto set to create in the hibernate configuration file and using it to connect to the derby database in network mode (not embedded, don't know if that is relevant). Here is my hibernate.cfg.xml
Asif Mohammed
  • 790
  • 4
  • 11
  • 25
6
votes
1 answer

Problems with Hibernates hbm2ddl.auto=validate and MySQL text types

I've tried to enable hbm2ddl.auto=validate on a project I've inherited. I now get a lot of wrong column type exceptions for String properties which are mapped either with text or mediumtext (MySQL database). The mapping is: @Column(name =…
Ben
  • 1,922
  • 3
  • 23
  • 37
6
votes
4 answers

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…
newbie
  • 24,286
  • 80
  • 201
  • 301
6
votes
3 answers

Table not created with hbm2ddl.auto=update in Hibernate 5

The database table is NOT auto-created by the update settings in hibernate-cfg.xml, with the following combination: Java 8 + Tomcat 8 + MySQL + Hibernate 5 Java version: java version "1.8.0_45" Java(TM) SE…
Ming
  • 61
  • 1
  • 4
5
votes
4 answers

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…
anon
1
2
3
13 14