Questions tagged [hbm2ddl]

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

198 questions
3
votes
2 answers

Fluent NHibernate automapping: One-to-many entities, many-to-many backend?

My goal is to use NHibernate schema generation along with Fluent NHibernate's automapper to generate my database. I'm having trouble with what I'll call "unidirectional many-to-many relationships." Many of my entities have localized resources. A…
roufamatic
  • 18,187
  • 7
  • 57
  • 86
3
votes
1 answer

How do I specify integers to be of a certain length via a JPA annotation

create table foo (id INT(10) not null ...) Instead of declaring id as "INTEGER", I would like to specify a length restriction as mentioned above. I use @Entity class Foo { @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique =…
user339108
  • 12,613
  • 33
  • 81
  • 112
3
votes
1 answer

Spring Boot 2.2.2 and "hibernate.hbm2ddl.auto=(create|create-drop|update|validate)" not working

My application is based on Spring Boot 2.2.2.RELEASE and PostgreSQL. I am relying on Spring's AutoConfiguration as far as persistence is concerned. My application.properties file contains the following: # Persistence dbVendor=postgresql # Basic…
Jochen T.
  • 41
  • 1
  • 6
3
votes
1 answer

How do I mimic Hibernate hbm2ddl "create" behaviour in Liquibase?

I've worked with liquibase 1.9.5 for a while now and got it to replace hibernate hbm2ddl strategy of creating tables and loading fixtures in it. Since it's a maven project and since I use hsqldb (using file create=true), I simply create the db in…
black sensei
  • 6,528
  • 22
  • 109
  • 188
3
votes
1 answer

How do I add custom comments to Hibernate hbm2ddl output?

I was curious if it is possible to add a SQL header comment to the sql generated by the hbm2ddl output. Specifically, it would be nice if I could add generated version strings to the Dialect object that would be output to the generated .sql…
tmarthal
  • 1,498
  • 19
  • 28
3
votes
1 answer

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…
Oded Peer
  • 2,377
  • 18
  • 25
3
votes
1 answer

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. …
Dave
  • 21,524
  • 28
  • 141
  • 221
3
votes
2 answers

Maven by example - NullPointer executing hibernate3:hbm2ddl

I am following the Maven by example guide to learn Maven. I am busy working through chapter 7, which is a simple multimodule enterprise project containing spring and hibernate. The example files for this chapter can be downloaded here, in the…
DieterDP
  • 4,039
  • 2
  • 29
  • 38
3
votes
1 answer

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?
Dan
  • 11,077
  • 20
  • 84
  • 119
3
votes
4 answers

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…
Rafe
  • 3,056
  • 1
  • 22
  • 25
3
votes
1 answer

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…
Damo
  • 11,410
  • 5
  • 57
  • 74
3
votes
1 answer

Hibernate: Missing column count

This is my entity: @Entity @Table(name="log_shop") public class LogShop { @Id @GeneratedValue private int id; private String platform; @Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime") private DateTime…
Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
3
votes
0 answers

How to log pastable DDL with HibernateJpaVendorAdapter

In a former project I used the hbm2ddl task in hibernate3-maven-plugin to generate the DDL code - I ran the maven task with debug output enabled and the DDL was logged to the console in a pastable fashion. In fact I used this code as the initial…
Alexander Hansen
  • 813
  • 8
  • 14
3
votes
1 answer

Issue with Hibernate's hbm2ddl creating a unique index unduly

I am encountering a serious issue with Hibernate's hbm2ddl and MySQL: Hibernate systematically creates a unique index for the one of the fields of my OneToMany associations as follows: Notice the UQ box is checked for the day_to_time_slots field…
balteo
  • 23,602
  • 63
  • 219
  • 412
3
votes
4 answers

HIbernate schema update error

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…
maddy