mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Added @Index annotation to generate single-column indexes
This commit is contained in:
@@ -8,21 +8,21 @@ import com.avaje.tests.model.basic.EBasic;
|
||||
|
||||
public class MainDdlWithSchema {
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String[] args) {
|
||||
|
||||
ServerConfig cfg = new ServerConfig();
|
||||
cfg.setName("pg");
|
||||
cfg.loadFromProperties();
|
||||
cfg.addClass(EBasic.class);
|
||||
|
||||
// .... other settings ...
|
||||
UnderscoreNamingConvention naming = new UnderscoreNamingConvention();
|
||||
naming.setSchema("foo");
|
||||
cfg.setNamingConvention(naming);
|
||||
cfg.setDdlGenerate(true);
|
||||
cfg.setDdlRun(true);
|
||||
EbeanServer ebean = EbeanServerFactory.create(cfg);
|
||||
//ebean.createSqlUpdate("create schema foo").execute();
|
||||
System.out.println(ebean);
|
||||
}
|
||||
ServerConfig cfg = new ServerConfig();
|
||||
cfg.setName("h2");
|
||||
cfg.loadFromProperties();
|
||||
cfg.addClass(EBasic.class);
|
||||
|
||||
// .... other settings ...
|
||||
//UnderscoreNamingConvention naming = new UnderscoreNamingConvention();
|
||||
//naming.setSchema("test");
|
||||
//cfg.setNamingConvention(naming);
|
||||
cfg.setDdlGenerate(true);
|
||||
cfg.setDdlRun(true);
|
||||
EbeanServer ebean = EbeanServerFactory.create(cfg);
|
||||
//ebean.createSqlUpdate("create schema foo").execute();
|
||||
System.out.println(ebean);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.avaje.ebean.annotation.EnumValue;
|
||||
import com.avaje.ebean.annotation.Index;
|
||||
|
||||
@Entity
|
||||
@Table(name = "e_basic")
|
||||
@@ -28,6 +29,7 @@ public class EBasic {
|
||||
|
||||
Status status;
|
||||
|
||||
@Index
|
||||
String name;
|
||||
|
||||
String description;
|
||||
|
||||
Reference in New Issue
Block a user