mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
Added @Index annotation to generate single-column indexes
This commit is contained in:
1 parent
11a6cd04ea
commit
31f56621ff
8 files changed
+246
-94
No files matched your search
@@ -22,12 +22,7 @@ import javax.persistence.Version;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import com.avaje.ebean.annotation.CreatedTimestamp;
|
||||
import com.avaje.ebean.annotation.EmbeddedColumns;
|
||||
import com.avaje.ebean.annotation.Encrypted;
|
||||
import com.avaje.ebean.annotation.Expose;
|
||||
import com.avaje.ebean.annotation.Formula;
|
||||
import com.avaje.ebean.annotation.UpdatedTimestamp;
|
||||
import com.avaje.ebean.annotation.*;
|
||||
import com.avaje.ebean.config.EncryptDeploy;
|
||||
import com.avaje.ebean.config.EncryptDeploy.Mode;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
@@ -65,7 +60,7 @@ public class AnnotationFields extends AnnotationParser {
|
||||
|
||||
if (GlobalProperties.getBoolean("ebean.lobEagerFetch", false)) {
|
||||
defaultLobFetchType = FetchType.EAGER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +99,7 @@ public class AnnotationFields extends AnnotationParser {
|
||||
if (prop.isId() && !prop.isEmbedded()) {
|
||||
prop.setEmbedded(true);
|
||||
}
|
||||
readEmbeddedAttributeOverrides((DeployBeanPropertyAssocOne<?>)prop);
|
||||
readEmbeddedAttributeOverrides((DeployBeanPropertyAssocOne<?>) prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +144,7 @@ public class AnnotationFields extends AnnotationParser {
|
||||
if (id != null) {
|
||||
readId(id, prop);
|
||||
}
|
||||
|
||||
|
||||
// determine the JDBC type using Lob/Temporal
|
||||
// otherwise based on the property Class
|
||||
Lob lob = get(prop, Lob.class);
|
||||
@@ -199,9 +194,9 @@ public class AnnotationFields extends AnnotationParser {
|
||||
if (notNull != null && isNotNullOnAllValidationGroups(notNull.groups())) {
|
||||
// Not null on all validation groups so enable
|
||||
// DDL generation of Not Null Constraint
|
||||
prop.setNullable(false);
|
||||
prop.setNullable(false);
|
||||
}
|
||||
|
||||
|
||||
Size size = get(prop, Size.class);
|
||||
if (size != null) {
|
||||
if (size.max() < Integer.MAX_VALUE) {
|
||||
@@ -229,7 +224,7 @@ public class AnnotationFields extends AnnotationParser {
|
||||
|
||||
} else {
|
||||
throw new RuntimeException("Can't use EmbeddedColumns on ScalarType "
|
||||
+ prop.getFullBeanName());
|
||||
+ prop.getFullBeanName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +241,7 @@ public class AnnotationFields extends AnnotationParser {
|
||||
if (!prop.isTransient()) {
|
||||
|
||||
EncryptDeploy encryptDeploy = util.getEncryptDeploy(info.getDescriptor().getBaseTableFull(),
|
||||
prop.getDbColumn());
|
||||
prop.getDbColumn());
|
||||
if (encryptDeploy == null || encryptDeploy.getMode().equals(Mode.MODE_ANNOTATION)) {
|
||||
Encrypted encrypted = get(prop, Encrypted.class);
|
||||
if (encrypted != null) {
|
||||
@@ -257,6 +252,11 @@ public class AnnotationFields extends AnnotationParser {
|
||||
}
|
||||
}
|
||||
|
||||
Index index = get(prop, Index.class);
|
||||
if (index != null) {
|
||||
prop.setIndexed(true);
|
||||
prop.setIndexName(index.value());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -313,7 +313,7 @@ public class AnnotationFields extends AnnotationParser {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private ScalarTypeEncryptedWrapper<?> createScalarType(DeployBeanProperty prop, ScalarType<?> st) {
|
||||
|
||||
// Use Java Encryptor wrapping the logical scalar type
|
||||
|
||||
Reference in new issue
Block a user