You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose to add new annotiation EntityIndex (for backward compatibility):
package tech.ydb.yoj.databind.schema;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface EntityIndex {
/**
* Class, records or interface that prescribes fields and their order for indexing
*
* @return index list
*/
Class[] value();
}
Examples:
Interface:
interface ValueIndexInterface<T> {
String getValueId();
String getValueId2();
}
@EntityIndex(ValueIndexInterface.class)
public class IndexedEntity implements Entity<IndexedEntity>, ValueIndexInterface<IndexedEntity> {
In this case data mapping for fields could be derived based on IndexedEntity mapping
Class or record (more flexible, sometimes flattened fields could be a part of index):
@EntityIndex({IndexedEntity.Key.class, IndexedEntity.Key2.class})
@Table(name = "table_with_indexes")
public class IndexedEntity implements Entity<IndexedEntity> {
@Value
public static class Key {
@Column(name = "value_id")
String valueId;
String valueId2;
}
public record Key2 (
@Column(name = "value_id")
String valueId,
String valueId2
) {
}
}
In both cases filed name can be overridden in index entity using @Colunm annotation.
The text was updated successfully, but these errors were encountered:
I propose to add new annotiation
EntityIndex
(for backward compatibility):Examples:
In this case data mapping for fields could be derived based on IndexedEntity mapping
In both cases filed name can be overridden in index entity using
@Colunm
annotation.The text was updated successfully, but these errors were encountered: