-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: primary keys with auto_increment?
PostPosted: Wed May 13, 2009 3:01 pm 
Newbie

Joined: Wed May 13, 2009 2:49 pm
Posts: 1
Hello

Is there an annotation to tell the schema-update to create primary keys with auto_increment?

And another switch to tell mysql to use InnoDB-Tables instead of the default myIsam?

And if there is no annotation (probably to db-specific), is there a hibernate-property to switch that?

_________________
cars | audi cars | college


Top
 Profile  
 
 Post subject: Re: primary keys with auto_increment?
PostPosted: Wed May 13, 2009 5:09 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
the dialects property is used to define the kind of tables on mysql:

Code:
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect


there are different kinds of dialects for all supported databases, for MySQL there are several: MyISAM, InnoDB and InnoDB on MySQL5. You can also create your own extending one and override the lowerlevel instructions you want.

for the primary keys use @GeneratedValue to generate autoincremental:

Code:
@Id
@GeneratedValue
public Long getId() {
   return id;
}


btw, this is the wrong forum for this questions;-)

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.