hibernate utility to manage the creation and/or deployment of database schemas (data definition language)
Questions tagged [hbm2ddl]
198 questions
5
votes
1 answer
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…

Wilhelm Kleu
- 10,821
- 4
- 36
- 48
5
votes
2 answers
Tell Hibernate's hbm2ddl to add MySQL enum columns for @Enumerated annotated fields
I'm creating a DB table using hbm2ddl with Java code similar to the following:
@Entity
public class Filter {
public enum Type {
TypeA, TypeB;
}
@Enumerated(EnumType.STRING)
private Type type;
}
It works fine, but for "type"…

Simon
- 78
- 4
5
votes
1 answer
Why does hbm2ddl.SchemaExport not run here?
Trying to play around with IInterceptor in NHibernate 2.1.2.4000 I've got the following bit of test code:
public class TestingNHibernateInterceptors
{
[Fact]
public void can_intercept_delete_for_audit_log()
{
FullyConfigureDb();
…

George Mauer
- 117,483
- 131
- 382
- 612
5
votes
1 answer
Multiple JPA persistence units pointing to same database?
Can we have more than one JPA persistence units pointing to same database, in different Java projects and deployed on the server at the same time? By same time I mean, not deployed at the same second but deployed together. I am using a hsqldb…

Vashishtha Jogi
- 12,120
- 2
- 19
- 20
5
votes
2 answers
MySQL DATETIME precision (joda-time, Hibernate, org.jadira.usertype, hbm2ddl)
In my hibernate-4 entity, I am mapping a joda-time DateTime property using the recommended jadira usertypes:
@Entity
@Table(name="timing")
public class TimingEntity {
...
@Basic(optional=false)
@Column(name="moment")
…

Pavel S.
- 1,202
- 1
- 13
- 29
5
votes
1 answer
Do you need to create index on the @id column of a Hibernate table
Do I need to add an index anoatation for the primary key of a hibernate table for decent performance, I assumed that marking a field with @id would mean an index was created
@Id
private String guid;
but I didnt notice anything being created in the…

Paul Taylor
- 13,411
- 42
- 184
- 351
5
votes
1 answer
NullPointerException when switching from hibernate-maven-plugin version 2.2 to version 3.0
I am updating the versions of my pom.xml dependencies and I've run into a vague error when I change the version of the hibernate3-maven-plugin from
…

Liam
- 1,041
- 2
- 17
- 31
5
votes
1 answer
Hibernate: Reversed column order by hbm2ddl
I let hbm2ddl create the tables for me (for dev purposes), and the columns are in reverse order of the fields in the class.
How can I make it create the columns in the same order as the class has?
I think Java classes do not store the order of…

Ondra Žižka
- 43,948
- 41
- 217
- 277
5
votes
2 answers
How to make hibernate hbm2ddl generate SQL with semicolon?
I use hibernate hbm2ddl to generate db schema script from entity classes. It works well but each line ends without a semicolon, which makes me have to manually add them. Is there any way to save me from this stupid job?

nixil
- 53
- 3
4
votes
1 answer
Hibernate 4.0 hibernatetool taskdef error
I'm using hibernate 4.0.0.CR4 and was trying the "Message" example from Java Persistence with Hibernate. I was able to compile and run the applicaiton using the ant build, but when i try exporting schema using hibernatetool i'm getting an…

Amit Khanna
- 489
- 4
- 16
4
votes
1 answer
Hibernate hbm2ddl.auto create/update skip View
I have a mapped entity to a database view e.g.
@Entity
@Immutable
@Table(name = "my_view")
public class MyView {
// some properties and getters
}
and my sql pendant is like create view my_view as select * from thisAndThat and stupid logic;
In my…

wolle
- 175
- 1
- 11
4
votes
0 answers
Hibernate5 - SchemaExport output the script in-memory as string instead to output file on disk
I'm trying to generate some database/table schemas on the fly, using hibernate 5 using something like this:
StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder().applySetting("hibernate.hbm2ddl.auto", "create")
…

Sergiu
- 2,502
- 6
- 35
- 57
4
votes
2 answers
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…

Michel
- 9,220
- 13
- 44
- 59
4
votes
2 answers
hbm2ddl ignores @Column annotation?
Why would hbm2ddl ignore the @Column annotation ?
This is my class :-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import…

Chris Milburn
- 862
- 1
- 12
- 20
4
votes
2 answers
Hibernate's 'hbm2ddl.auto' property with value 'create' is not re-creating table
I'm working on my first simple Hibernate application. The crux of the problem is, I had renamed a member of persistent class (with apt changes to all other parts) and re-run the application. As 'hbm2ddl.auto' property is assigned 'create' value in…

user1418717
- 425
- 2
- 5
- 13